Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add variant data loader
Tomasz Szymanskiea2b116204f2
diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.pyindex 52d1535f74..e1e095cd74 100644--- a/saleor/graphql/product/types/products.py+++ b/saleor/graphql/product/types/products.py@@ -53,6 +53,7 @@ from ..dataloaders import (ImagesByProductIdLoader,ImagesByProductVariantIdLoader,ProductByIdLoader,+ ProductVariantByIdLoader,ProductVariantsByProductIdLoader,SelectedAttributesByProductIdLoader,SelectedAttributesByProductVariantIdLoader,@@ -516,6 +517,10 @@ class Product(CountableDjangoObjectType):"default_variant",]+ @staticmethod+ def resolve_default_variant(root: models.Product, info):+ return ProductVariantByIdLoader(info.context).load(root.default_variant_id)+@staticmethoddef resolve_category(root: models.Product, info):category_id = root.category_id