Skip to content

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

Allow to fetch category's siblings

Marcin Gębalac3e2d5dd0b68
diff --git a/saleor/graphql/api.py b/saleor/graphql/api.py
index 249bdaac1b..7a4c2b2597 100644
--- a/saleor/graphql/api.py
+++ b/saleor/graphql/api.py
@@ -51,7 +51,6 @@ ProductType.Connection = connection_with_count(ProductType)
class CategoryType(DjangoObjectType):
- children = graphene.List(lambda: CategoryType)
products = relay.ConnectionField(
ProductType,
attributes=graphene.Argument(
@@ -70,6 +69,8 @@ class CategoryType(DjangoObjectType):
than or equal to the given value"""))
products_count = graphene.Int()
url = graphene.String()
+ children = graphene.List(lambda: CategoryType)
+ siblings = graphene.List(lambda: CategoryType)
class Meta:
model = Category
@@ -78,6 +79,9 @@ class CategoryType(DjangoObjectType):
def resolve_children(self, args, context, info):
return self.children.all()
+ def resolve_siblings(self, args, context, info):
+ return self.get_siblings()
+
def resolve_products(self, args, context, info):
qs = self.products.prefetch_for_api()
attributes_filter = args.get('attributes')