Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add possibility to fetch unpublished products for service account

fowczarek401197eb505c
diff --git a/saleor/graphql/product/resolvers.py b/saleor/graphql/product/resolvers.py
index 90b9ad73bb..e537cc06c9 100644
--- a/saleor/graphql/product/resolvers.py
+++ b/saleor/graphql/product/resolvers.py
@@ -142,6 +142,8 @@ def resolve_products(
):
user = info.context.user
+ if user.is_anonymous and info.context.service_account:
+ user = info.context.service_account
qs = models.Product.objects.visible_to_user(user)
qs = sort_products(qs, sort_by)