Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
The products in homepage should be visible to request.user instead of anonymous user
Unknownc81d97e2291f
diff --git a/saleor/core/views.py b/saleor/core/views.pyindex 44f2b9f3a1..a15cf821a5 100644--- a/saleor/core/views.py+++ b/saleor/core/views.py@@ -14,6 +14,7 @@ from ..seo.schema.webpage import get_webpage_schemadef home(request):products = products_for_homepage(+ request.user,request.site.settings.homepage_collection)[:8]products = list(products_with_availability(products, discounts=request.discounts, taxes=request.taxes,diff --git a/saleor/product/utils/__init__.py b/saleor/product/utils/__init__.pyindex f9385c0f3e..e9b255b990 100644--- a/saleor/product/utils/__init__.py+++ b/saleor/product/utils/__init__.py@@ -1,7 +1,6 @@from urllib.parse import urlencodefrom django.conf import settings-from django.contrib.auth.models import AnonymousUserfrom django.db.models import Ffrom ...checkout.utils import (@@ -39,8 +38,7 @@ def products_for_products_list(user):return products-def products_for_homepage(homepage_collection):- user = AnonymousUser()+def products_for_homepage(user, homepage_collection):products = products_visible_to_user(user)products = products.prefetch_related('translations', 'images', 'variants__variant_images__image')