Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add url field in category schema
Marcin Gębala798f9d7d6f7c
diff --git a/saleor/graphql/api.py b/saleor/graphql/api.pyindex 86b9cbe731..82ce255d0a 100644--- a/saleor/graphql/api.py+++ b/saleor/graphql/api.py@@ -46,6 +46,7 @@ class ProductType(DjangoObjectType):class CategoryType(DjangoObjectType):+ url = graphene.String()products = relay.ConnectionField(ProductType,attributes=graphene.List(AttributesFilterScalar),@@ -55,6 +56,10 @@ class CategoryType(DjangoObjectType):model = Categoryinterfaces = (relay.Node, DjangoPkInterface)+ @graphene.resolve_only_args+ def resolve_url(self):+ return self.get_absolute_url()+def resolve_products(self, args, context, info):qs = self.products.prefetch_for_api()attributes_filter = args.get('attributes')