Skip to content

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

Add docstring to filter_quantity

IKarbowiake2542ac77ede
diff --git a/saleor/graphql/product/filters.py b/saleor/graphql/product/filters.py
index 4c8aad9d26..15a88f28c1 100644
--- a/saleor/graphql/product/filters.py
+++ b/saleor/graphql/product/filters.py
@@ -261,6 +261,12 @@ def filter_warehouses(qs, _, value):
def filter_quantity(qs, quantity_value, warehouses=None):
+ """Filter products queryset by product variants quantity.
+
+ Return product queryset which contains at least one variant with aggregated quantity
+ between given range. If warehouses is given, it aggregates quantity only
+ from stocks which are in given warehouses.
+ """
product_variants = ProductVariant.objects.filter(product__in=qs)
if warehouses:
_, warehouse_pks = resolve_global_ids_to_primary_keys(