Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Handle product resolver case when there are no variants
Tomasz Szymanski1a5203e65741
diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.pyindex dc8a769288..012a3846a4 100644--- a/saleor/graphql/product/types/products.py+++ b/saleor/graphql/product/types/products.py@@ -512,6 +512,10 @@ class Product(CountableDjangoObjectType):@staticmethoddef resolve_default_variant(root: models.Product, info):+ default_variant_id = root.default_variant_id+ if default_variant_id is None:+ return None+return ProductVariantByIdLoader(info.context).load(root.default_variant_id)@staticmethod