Skip to content

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

Revert adding attributeValue.referencedObject (#18024)

Iga Karbowiake3bf06aea42a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3a48acd4c2..9f942f89a6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -80,7 +80,6 @@ All notable, unreleased changes to this project will be documented in this file.
- `collection.products`
- `pageType.availableAttributes`
- Extend `AttributeEntityType` with `CATEGORY` and `COLLECTION`. You can now assign category and collection as a attribute reference.
-- Attribute values now expose the `referencedObject`, allowing for easier access to the linked entity.
- You can now filter and search attribute choices using the new `where` and `search` fields on the `attribute.choices` query.
- Filtering products by `category` now also includes subcategories. The filter will return products that belong to the specified categories as well as their subcategories.
- Deprecated `Transaction.gatewayResponse` field. Please migrate to Transaction API and Apps.
diff --git a/saleor/graphql/attribute/types.py b/saleor/graphql/attribute/types.py
index ab325dac19..5ea16764cd 100644
--- a/saleor/graphql/attribute/types.py
+++ b/saleor/graphql/attribute/types.py
@@ -1,7 +1,7 @@
import graphene
from django.conf import settings
-from ...attribute import AttributeEntityType, AttributeInputType, models
+from ...attribute import AttributeInputType, models
from ...permission.enums import (
PagePermissions,
PageTypePermissions,
@@ -40,8 +40,6 @@ from ..core.types import (
from ..core.types.context import ChannelContextType, ChannelContextTypeForObjectType
from ..decorators import check_attribute_required_permissions
from ..meta.types import ObjectWithMetadata
-from ..page.dataloaders import PageByIdLoader
-from ..product.dataloaders.products import ProductByIdLoader, ProductVariantByIdLoader
from ..translations.fields import TranslationField
from ..translations.types import AttributeTranslation, AttributeValueTranslation
from .dataloaders import (
@@ -85,10 +83,6 @@ class AttributeValue(ChannelContextType[models.AttributeValue]):
)
input_type = AttributeInputTypeEnum(description=AttributeDescriptions.INPUT_TYPE)
reference = graphene.ID(description="The ID of the referenced object.")
- referenced_object = graphene.Field(
- "saleor.graphql.attribute.unions.AttributeValueReferencedObject",
- description="The object referenced by the attribute value." + ADDED_IN_322,
- )
file = graphene.Field(
File, description=AttributeValueDescriptions.FILE, required=False
@@ -117,49 +111,6 @@ class AttributeValue(ChannelContextType[models.AttributeValue]):
interfaces = [graphene.relay.Node]
model = models.AttributeValue
- @staticmethod
- def resolve_referenced_object(
- root: ChannelContext[models.AttributeValue], info: ResolveInfo
- ):
- attr_value = root.node
-
- def prepare_referenced_object(attribute):
- if not attribute:
- return None
- reference_pk = get_reference_pk(attribute, attr_value)
-
- if reference_pk is None:
- return None
-
- def wrap_with_channel_context(_object):
- return ChannelContext(node=_object, channel_slug=root.channel_slug)
-
- if attribute.entity_type == AttributeEntityType.PRODUCT:
- return (
- ProductByIdLoader(info.context)
- .load(reference_pk)
- .then(wrap_with_channel_context)
- )
- if attribute.entity_type == AttributeEntityType.PRODUCT_VARIANT:
- return (
- ProductVariantByIdLoader(info.context)
- .load(reference_pk)
- .then(wrap_with_channel_context)
- )
- if attribute.entity_type == AttributeEntityType.PAGE:
- return (
- PageByIdLoader(info.context)
- .load(reference_pk)
- .then(wrap_with_channel_context)
- )
- return None
-
- return (
- AttributesByAttributeId(info.context)
- .load(attr_value.attribute_id)
- .then(prepare_referenced_object)
- )
-
def resolve_input_type(
root: ChannelContext[models.AttributeValue], info: ResolveInfo
):
diff --git a/saleor/graphql/attribute/unions.py b/saleor/graphql/attribute/unions.py
deleted file mode 100644
index 68e12078a3..0000000000
--- a/saleor/graphql/attribute/unions.py
+++ /dev/null
@@ -1,28 +0,0 @@
-import graphene
-
-from ...page import models as page_models
-from ...product import models as product_models
-from ..core.context import ChannelContext
-from ..page.types import Page
-from ..product.types import Product, ProductVariant
-
-
-class AttributeValueReferencedObject(graphene.Union):
- class Meta:
- types = (
- Product,
- ProductVariant,
- Page,
- )
-
- @classmethod
- def resolve_type(cls, instance, info):
- if isinstance(instance, ChannelContext):
- instance = instance.node
- if isinstance(instance, product_models.Product):
- return Product
- if isinstance(instance, product_models.ProductVariant):
- return ProductVariant
- if isinstance(instance, page_models.Page):
- return Page
- return super().resolve_type(instance, info)
diff --git a/saleor/graphql/page/tests/queries/test_page.py b/saleor/graphql/page/tests/queries/test_page.py
index 6e2727a8ef..5a56cf7ee8 100644
--- a/saleor/graphql/page/tests/queries/test_page.py
+++ b/saleor/graphql/page/tests/queries/test_page.py
@@ -7,7 +7,7 @@ from .....attribute.tests.model_helpers import (
get_page_attributes,
)
from .....attribute.utils import associate_attribute_values_to_instance
-from .....page.models import Page, PageTranslation
+from .....page.models import PageTranslation
from .....tests.utils import dummy_editorjs
from ....core.enums import LanguageCodeEnum
from ....tests.utils import get_graphql_content, get_graphql_content_from_response
@@ -471,24 +471,6 @@ query Page($id: ID!, $slug: String!) {
id
slug
}
- values {
- reference
- referencedObject {
- __typename
- ... on Page {
- id
- publicationDate
- }
- ... on ProductVariant {
- id
- created
- }
- ... on Product {
- id
- created
- }
- }
- }
}
}
}
@@ -622,379 +604,6 @@ def test_page_attribute_visible_in_storefront_for_staff_is_always_returned(
assert content["data"]["page"]["attribute"]["attribute"]["slug"] == attribute.slug
-def test_page_attribute_with_referenced_page_object(
- staff_api_client,
- page_type_page_reference_attribute,
- permission_manage_pages,
- page,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_pages)
-
- # Create a second page to reference
- referenced_page = Page.objects.create(
- title="Referenced Page",
- slug="referenced-page",
- page_type=page.page_type,
- is_published=True,
- )
-
- page_type = page.page_type
- page_type.page_attributes.all().delete()
- page_type.page_attributes.add(page_type_page_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=page_type_page_reference_attribute,
- name=f"Page {referenced_page.pk}",
- slug=f"page-{referenced_page.pk}",
- reference_page=referenced_page,
- )
-
- associate_attribute_values_to_instance(
- page, {page_type_page_reference_attribute.pk: [attribute_value]}
- )
-
- query = QUERY_PAGE_WITH_ATTRIBUTE
-
- # when
- variables = {
- "id": graphene.Node.to_global_id("Page", page.pk),
- "slug": page_type_page_reference_attribute.slug,
- }
- response = staff_api_client.post_graphql(query, variables)
-
- # then
- content = get_graphql_content(response)
- page_data = content["data"]["page"]
- page_attributes = page_data["attributes"]
- assert len(page_attributes) == 1
-
- attribute_with_reference = page_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "page-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
- assert value["reference"] == graphene.Node.to_global_id("Page", referenced_page.id)
- assert value["referencedObject"]["__typename"] == "Page"
- assert value["referencedObject"]["id"] == graphene.Node.to_global_id(
- "Page", referenced_page.id
- )
-
-
-def test_page_attribute_with_referenced_product_variant_object(
- staff_api_client,
- page_type_variant_reference_attribute,
- permission_manage_pages,
- page,
- product,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_pages)
-
- product_variant = product.variants.first()
- page_type = page.page_type
- page_type.page_attributes.all().delete()
- page_type.page_attributes.add(page_type_variant_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=page_type_variant_reference_attribute,
- name=f"Variant {product_variant.pk}",
- slug=f"variant-{product_variant.pk}",
- reference_variant=product_variant,
- )
-
- associate_attribute_values_to_instance(
- page,
- {page_type_variant_reference_attribute.pk: [attribute_value]},
- )
-
- query = QUERY_PAGE_WITH_ATTRIBUTE
-
- # when
- variables = {
- "id": graphene.Node.to_global_id("Page", page.pk),
- "slug": page_type_variant_reference_attribute.slug,
- }
- response = staff_api_client.post_graphql(query, variables)
-
- # then
- content = get_graphql_content(response)
- page_data = content["data"]["page"]
- page_attributes = page_data["attributes"]
- assert len(page_attributes) == 1
-
- attribute_with_reference = page_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "variant-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
- assert value["reference"] == graphene.Node.to_global_id(
- "ProductVariant", product_variant.id
- )
- assert value["referencedObject"]["__typename"] == "ProductVariant"
- assert value["referencedObject"]["id"] == graphene.Node.to_global_id(
- "ProductVariant", product_variant.id
- )
-
-
-def test_page_attribute_with_referenced_product_object(
- staff_api_client,
- page_type_product_reference_attribute,
- permission_manage_pages,
- page,
- product,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_pages)
-
- page_type = page.page_type
- page_type.page_attributes.all().delete()
- page_type.page_attributes.add(page_type_product_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=page_type_product_reference_attribute,
- name=f"Product {product.pk}",
- slug=f"product-{product.pk}",
- reference_product=product,
- )
-
- associate_attribute_values_to_instance(
- page,
- {page_type_product_reference_attribute.pk: [attribute_value]},
- )
-
- query = QUERY_PAGE_WITH_ATTRIBUTE
-
- # when
- variables = {
- "id": graphene.Node.to_global_id("Page", page.pk),
- "slug": page_type_product_reference_attribute.slug,
- }
- response = staff_api_client.post_graphql(query, variables)
-
- # then
- content = get_graphql_content(response)
- page_data = content["data"]["page"]
- page_attributes = page_data["attributes"]
- assert len(page_attributes) == 1
-
- attribute_with_reference = page_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "product-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
- assert value["reference"] == graphene.Node.to_global_id("Product", product.id)
- assert value["referencedObject"]["__typename"] == "Product"
- assert value["referencedObject"]["id"] == graphene.Node.to_global_id(
- "Product", product.id
- )
-
-
-QUERY_PAGE_WITH_ATTRIBUTE_AND_CHANNEL = """
-query Page($id: ID!, $channel: String) {
- page(id: $id, channel: $channel) {
- attributes {
- attribute {
- id
- slug
- }
- values {
- reference
- referencedObject {
- __typename
- ... on Page {
- id
- }
- ... on ProductVariant {
- id
- pricing {
- onSale
- }
- }
- ... on Product {
- id
- created
- pricing {
- onSale
- }
- }
- }
- }
- }
- }
-}
-"""
-
-
-def test_page_attribute_with_referenced_page_object_and_channel_slug(
- staff_api_client,
- page_type_page_reference_attribute,
- permission_manage_pages,
- page,
- channel_USD,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_pages)
-
- # Create a second page to reference
- referenced_page = Page.objects.create(
- title="Referenced Page",
- slug="referenced-page",
- page_type=page.page_type,
- is_published=True,
- )
-
- page_type = page.page_type
- page_type.page_attributes.all().delete()
- page_type.page_attributes.add(page_type_page_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=page_type_page_reference_attribute,
- name=f"Page {referenced_page.pk}",
- slug=f"page-{referenced_page.pk}",
- reference_page=referenced_page,
- )
-
- associate_attribute_values_to_instance(
- page, {page_type_page_reference_attribute.pk: [attribute_value]}
- )
-
- query = QUERY_PAGE_WITH_ATTRIBUTE_AND_CHANNEL
-
- # when
- variables = {
- "id": graphene.Node.to_global_id("Page", page.pk),
- "channel": channel_USD.slug,
- }
- response = staff_api_client.post_graphql(query, variables)
-
- # then
- content = get_graphql_content(response)
- page_data = content["data"]["page"]
- page_attributes = page_data["attributes"]
- assert len(page_attributes) == 1
-
- attribute_with_reference = page_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "page-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
- assert value["reference"] == graphene.Node.to_global_id("Page", referenced_page.id)
- assert value["referencedObject"]["__typename"] == "Page"
- assert value["referencedObject"]["id"] == graphene.Node.to_global_id(
- "Page", referenced_page.id
- )
-
-
-def test_page_attribute_with_referenced_product_variant_object_and_channel_slug(
- staff_api_client,
- page_type_variant_reference_attribute,
- permission_manage_pages,
- page,
- product,
- channel_USD,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_pages)
-
- product_variant = product.variants.first()
- page_type = page.page_type
- page_type.page_attributes.all().delete()
- page_type.page_attributes.add(page_type_variant_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=page_type_variant_reference_attribute,
- name=f"Variant {product_variant.pk}",
- slug=f"variant-{product_variant.pk}",
- reference_variant=product_variant,
- )
-
- associate_attribute_values_to_instance(
- page,
- {page_type_variant_reference_attribute.pk: [attribute_value]},
- )
-
- query = QUERY_PAGE_WITH_ATTRIBUTE_AND_CHANNEL
-
- # when
- variables = {
- "id": graphene.Node.to_global_id("Page", page.pk),
- "channel": channel_USD.slug,
- }
- response = staff_api_client.post_graphql(query, variables)
-
- # then
- content = get_graphql_content(response)
- page_data = content["data"]["page"]
- page_attributes = page_data["attributes"]
- assert len(page_attributes) == 1
-
- attribute_with_reference = page_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "variant-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
- assert value["reference"] == graphene.Node.to_global_id(
- "ProductVariant", product_variant.id
- )
- assert value["referencedObject"]["__typename"] == "ProductVariant"
- # having pricing object means that we passed channel_slug to the variant
- assert value["referencedObject"]["pricing"]
-
-
-def test_page_attribute_with_referenced_product_object_and_channel_slug(
- staff_api_client,
- page_type_product_reference_attribute,
- permission_manage_pages,
- page,
- product,
- channel_USD,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_pages)
-
- page_type = page.page_type
- page_type.page_attributes.all().delete()
- page_type.page_attributes.add(page_type_product_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=page_type_product_reference_attribute,
- name=f"Product {product.pk}",
- slug=f"product-{product.pk}",
- reference_product=product,
- )
-
- associate_attribute_values_to_instance(
- page,
- {page_type_product_reference_attribute.pk: [attribute_value]},
- )
-
- query = QUERY_PAGE_WITH_ATTRIBUTE_AND_CHANNEL
-
- # when
- variables = {
- "id": graphene.Node.to_global_id("Page", page.pk),
- "channel": channel_USD.slug,
- }
- response = staff_api_client.post_graphql(query, variables)
-
- # then
- content = get_graphql_content(response)
- page_data = content["data"]["page"]
- page_attributes = page_data["attributes"]
- assert len(page_attributes) == 1
-
- attribute_with_reference = page_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "product-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
- assert value["reference"] == graphene.Node.to_global_id("Product", product.id)
- assert value["referencedObject"]["__typename"] == "Product"
- # having pricing object means that we passed channel_slug to the product
- assert value["referencedObject"]["pricing"]
-
-
def test_page_channel_not_found(staff_api_client, page, permission_manage_pages):
# given
staff_api_client.user.user_permissions.add(permission_manage_pages)
diff --git a/saleor/graphql/page/tests/queries/test_pages.py b/saleor/graphql/page/tests/queries/test_pages.py
index 72afc39878..85531bdee6 100644
--- a/saleor/graphql/page/tests/queries/test_pages.py
+++ b/saleor/graphql/page/tests/queries/test_pages.py
@@ -3,8 +3,6 @@ import pytest
from django.utils import timezone
from freezegun import freeze_time
-from .....attribute.models.base import AttributeValue
-from .....attribute.utils import associate_attribute_values_to_instance
from .....page.models import Page
from .....tests.utils import dummy_editorjs
from ....tests.utils import get_graphql_content
@@ -393,26 +391,6 @@ PAGES_QUERY_WITH_ATTRIBUTE_AND_CHANNEL = """
values {
id
slug
- reference
- referencedObject {
- __typename
- ... on Page {
- id
- }
- ... on ProductVariant {
- id
- pricing {
- onSale
- }
- }
- ... on Product {
- id
- created
- pricing {
- onSale
- }
- }
- }
}
}
}
@@ -422,117 +400,6 @@ PAGES_QUERY_WITH_ATTRIBUTE_AND_CHANNEL = """
"""
-def test_pages_attribute_with_referenced_product_variant_object_and_channel_slug(
- staff_api_client,
- page_type_variant_reference_attribute,
- permission_manage_pages,
- page,
- product,
- channel_USD,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_pages)
-
- product_variant = product.variants.first()
- page_type = page.page_type
- page_type.page_attributes.all().delete()
- page_type.page_attributes.add(page_type_variant_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=page_type_variant_reference_attribute,
- name=f"Variant {product_variant.pk}",
- slug=f"variant-{product_variant.pk}",
- reference_variant=product_variant,
- )
-
- associate_attribute_values_to_instance(
- page,
- {page_type_variant_reference_attribute.pk: [attribute_value]},
- )
-
- query = PAGES_QUERY_WITH_ATTRIBUTE_AND_CHANNEL
-
- # when
- variables = {
- "channel": channel_USD.slug,
- }
- response = staff_api_client.post_graphql(query, variables)
-
- # then
- content = get_graphql_content(response)
- pages_data = content["data"]["pages"]["edges"]
- assert len(pages_data) == 1
- page_data = pages_data[0]["node"]
- page_attributes = page_data["attributes"]
- assert len(page_attributes) == 1
-
- attribute_with_reference = page_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "variant-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
- assert value["reference"] == graphene.Node.to_global_id(
- "ProductVariant", product_variant.id
- )
- assert value["referencedObject"]["__typename"] == "ProductVariant"
- # having pricing object means that we passed channel_slug to the variant
- assert value["referencedObject"]["pricing"]
-
-
-def test_pages_attribute_with_referenced_product_object_and_channel_slug(
- staff_api_client,
- page_type_product_reference_attribute,
- permission_manage_pages,
- page,
- product,
- channel_USD,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_pages)
-
- page_type = page.page_type
- page_type.page_attributes.all().delete()
- page_type.page_attributes.add(page_type_product_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=page_type_product_reference_attribute,
- name=f"Product {product.pk}",
- slug=f"product-{product.pk}",
- reference_product=product,
- )
-
- associate_attribute_values_to_instance(
- page,
- {page_type_product_reference_attribute.pk: [attribute_value]},
- )
-
- query = PAGES_QUERY_WITH_ATTRIBUTE_AND_CHANNEL
-
- # when
- variables = {
- "channel": channel_USD.slug,
- }
- response = staff_api_client.post_graphql(query, variables)
-
- # then
- content = get_graphql_content(response)
- pages_data = content["data"]["pages"]["edges"]
- assert len(pages_data) == 1
- page_data = pages_data[0]["node"]
- page_attributes = page_data["attributes"]
- assert len(page_attributes) == 1
-
- attribute_with_reference = page_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "product-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
- assert value["reference"] == graphene.Node.to_global_id("Product", product.id)
- assert value["referencedObject"]["__typename"] == "Product"
- # having pricing object means that we passed channel_slug to the product
- assert value["referencedObject"]["pricing"]
-
-
def test_pages_attribute_with_incorrect_channel_slug(
staff_api_client,
page_type_variant_reference_attribute,
diff --git a/saleor/graphql/product/tests/test_attributes.py b/saleor/graphql/product/tests/test_attributes.py
index e941ccbe3b..9bd42be725 100644
--- a/saleor/graphql/product/tests/test_attributes.py
+++ b/saleor/graphql/product/tests/test_attributes.py
@@ -36,28 +36,6 @@ QUERY_PRODUCT_AND_VARIANTS_ATTRIBUTES = """
}
values {
slug
- reference
- referencedObject {
- __typename
- ... on Page {
- id
- publicationDate
- }
- ... on ProductVariant {
- id
- created
- pricing {
- onSale
- }
- }
- ... on Product {
- id
- created
- pricing {
- onSale
- }
- }
- }
}
}
variants {
@@ -68,28 +46,6 @@ QUERY_PRODUCT_AND_VARIANTS_ATTRIBUTES = """
}
values {
slug
- reference
- referencedObject {
- __typename
- ... on Page {
- id
- publicationDate
- }
- ... on ProductVariant {
- id
- created
- pricing {
- onSale
- }
- }
- ... on Product {
- id
- created
- pricing {
- onSale
- }
- }
- }
}
}
}
@@ -1811,325 +1767,3 @@ def test_sort_product_variant_attribute_values_invalid_value_id(
assert errors[0]["code"] == ProductErrorCode.NOT_FOUND.name
assert errors[0]["field"] == "moves"
assert errors[0]["values"] == [invalid_value_id]
-
-
-def test_product_attribute_with_referenced_page_object(
- staff_api_client,
- product_type_page_reference_attribute,
- permission_manage_products,
- page,
- product,
- channel_USD,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_products)
-
- product_type = product.product_type
- product_type.product_attributes.all().delete()
-
- product_type.product_attributes.add(product_type_page_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=product_type_page_reference_attribute,
- name=f"Page {page.pk}",
- slug=f"page-{page.pk}",
- reference_page=page,
- )
-
- associate_attribute_values_to_instance(
- product, {product_type_page_reference_attribute.pk: [attribute_value]}
- )
-
- query = QUERY_PRODUCT_AND_VARIANTS_ATTRIBUTES
-
- # when
- response = staff_api_client.post_graphql(query, {"channel": channel_USD.slug})
-
- # then
- content = get_graphql_content(response)
- products = content["data"]["products"]["edges"]
- assert len(products) == 1
-
- product_attributes = products[0]["node"]["attributes"]
- assert len(product_attributes) == 1
-
- attribute_with_reference = product_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "page-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
- assert value["reference"] == graphene.Node.to_global_id("Page", page.id)
- assert value["referencedObject"]["__typename"] == "Page"
- assert value["referencedObject"]["id"] == graphene.Node.to_global_id(
- "Page", page.id
- )
-
-
-def test_product_attribute_with_referenced_product_variant_object(
- staff_api_client,
- product_type_variant_reference_attribute,
- permission_manage_products,
- product,
- channel_USD,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_products)
-
- product_variant = product.variants.first()
- product_type = product.product_type
- product_type.product_attributes.all().delete()
- product_type.product_attributes.add(product_type_variant_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=product_type_variant_reference_attribute,
- name=f"Variant {product_variant.pk}",
- slug=f"variant-{product_variant.pk}",
- reference_variant=product_variant,
- )
-
- associate_attribute_values_to_instance(
- product, {product_type_variant_reference_attribute.pk: [attribute_value]}
- )
-
- query = QUERY_PRODUCT_AND_VARIANTS_ATTRIBUTES
-
- # when
- response = staff_api_client.post_graphql(query, {"channel": channel_USD.slug})
-
- # then
- content = get_graphql_content(response)
- products = content["data"]["products"]["edges"]
- assert len(products) == 1
-
- product_attributes = products[0]["node"]["attributes"]
- assert len(product_attributes) == 1
-
- attribute_with_reference = product_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "variant-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
- assert value["reference"] == graphene.Node.to_global_id(
- "ProductVariant", product_variant.id
- )
- assert value["referencedObject"]["__typename"] == "ProductVariant"
- assert value["referencedObject"]["id"] == graphene.Node.to_global_id(
- "ProductVariant", product_variant.id
- )
- # having pricing object means that we passed channel_slug to the variant
- assert value["referencedObject"]["pricing"]
-
-
-def test_product_attribute_with_referenced_product_object(
- staff_api_client,
- product_type_product_reference_attribute,
- permission_manage_products,
- product,
- channel_USD,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_products)
-
- product_type = product.product_type
- product_type.product_attributes.all().delete()
- product_type.product_attributes.add(product_type_product_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=product_type_product_reference_attribute,
- name=f"Product {product.pk}",
- slug=f"product-{product.pk}",
- reference_product=product,
- )
-
- associate_attribute_values_to_instance(
- product, {product_type_product_reference_attribute.pk: [attribute_value]}
- )
-
- query = QUERY_PRODUCT_AND_VARIANTS_ATTRIBUTES
-
- # when
- response = staff_api_client.post_graphql(query, {"channel": channel_USD.slug})
-
- # then
- content = get_graphql_content(response)
- products = content["data"]["products"]["edges"]
- assert len(products) == 1
-
- product_attributes = products[0]["node"]["attributes"]
- assert len(product_attributes) == 1
-
- attribute_with_reference = product_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "product-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
- assert value["reference"] == graphene.Node.to_global_id("Product", product.id)
- assert value["referencedObject"]["__typename"] == "Product"
- assert value["referencedObject"]["id"] == graphene.Node.to_global_id(
- "Product", product.id
- )
- # having pricing object means that we passed channel_slug to the product
- assert value["referencedObject"]["pricing"]
-
-
-def test_product_variant_attribute_with_referenced_page_object(
- staff_api_client,
- product_type_page_reference_attribute,
- permission_manage_products,
- page,
- product,
- channel_USD,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_products)
-
- product_variant = product.variants.first()
- product_type = product.product_type
- product_type.variant_attributes.all().delete()
- product_type.variant_attributes.add(product_type_page_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=product_type_page_reference_attribute,
- name=f"Page {page.pk}",
- slug=f"page-{page.pk}",
- reference_page=page,
- )
-
- associate_attribute_values_to_instance(
- product_variant, {product_type_page_reference_attribute.pk: [attribute_value]}
- )
-
- query = QUERY_PRODUCT_AND_VARIANTS_ATTRIBUTES
-
- # when
- response = staff_api_client.post_graphql(query, {"channel": channel_USD.slug})
-
- # then
- content = get_graphql_content(response)
- products = content["data"]["products"]["edges"]
- assert len(products) == 1
-
- variant_attributes = products[0]["node"]["variants"][0]["attributes"]
- assert len(variant_attributes) == 1
-
- attribute_with_reference = variant_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "page-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
- assert value["reference"] == graphene.Node.to_global_id("Page", page.id)
- assert value["referencedObject"]["__typename"] == "Page"
- assert value["referencedObject"]["id"] == graphene.Node.to_global_id(
- "Page", page.id
- )
-
-
-def test_product_variant_attribute_with_referenced_product_variant_object(
- staff_api_client,
- product_type_variant_reference_attribute,
- permission_manage_products,
- product,
- channel_USD,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_products)
-
- product_variant = product.variants.first()
- product_type = product.product_type
- product_type.variant_attributes.all().delete()
- product_type.variant_attributes.add(product_type_variant_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=product_type_variant_reference_attribute,
- name=f"Variant {product_variant.pk}",
- slug=f"variant-{product_variant.pk}",
- reference_variant=product_variant,
- )
-
- associate_attribute_values_to_instance(
- product_variant,
- {product_type_variant_reference_attribute.pk: [attribute_value]},
- )
-
- query = QUERY_PRODUCT_AND_VARIANTS_ATTRIBUTES
-
- # when
- response = staff_api_client.post_graphql(query, {"channel": channel_USD.slug})
-
- # then
- content = get_graphql_content(response)
- products = content["data"]["products"]["edges"]
- assert len(products) == 1
-
- variant_attributes = products[0]["node"]["variants"][0]["attributes"]
- assert len(variant_attributes) == 1
-
- attribute_with_reference = variant_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "variant-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
-
- assert value["reference"] == graphene.Node.to_global_id(
- "ProductVariant", product_variant.id
- )
- assert value["referencedObject"]["__typename"] == "ProductVariant"
- assert value["referencedObject"]["id"] == graphene.Node.to_global_id(
- "ProductVariant", product_variant.id
- )
- # having pricing object means that we passed channel_slug to the variant
- assert value["referencedObject"]["pricing"]
-
-
-def test_product_variant_attribute_with_referenced_product_object(
- staff_api_client,
- product_type_product_reference_attribute,
- permission_manage_products,
- product,
- channel_USD,
-):
- # given
- staff_api_client.user.user_permissions.add(permission_manage_products)
-
- product_variant = product.variants.first()
- product_type = product.product_type
- product_type.variant_attributes.all().delete()
- product_type.variant_attributes.add(product_type_product_reference_attribute)
-
- attribute_value = AttributeValue.objects.create(
- attribute=product_type_product_reference_attribute,
- name=f"Product {product.pk}",
- slug=f"product-{product.pk}",
- reference_product=product,
- )
-
- associate_attribute_values_to_instance(
- product_variant,
- {product_type_product_reference_attribute.pk: [attribute_value]},
- )
-
- query = QUERY_PRODUCT_AND_VARIANTS_ATTRIBUTES
-
- # when
- response = staff_api_client.post_graphql(query, {"channel": channel_USD.slug})
-
- # then
- content = get_graphql_content(response)
- products = content["data"]["products"]["edges"]
- assert len(products) == 1
-
- variant_attributes = products[0]["node"]["variants"][0]["attributes"]
- assert len(variant_attributes) == 1
-
- attribute_with_reference = variant_attributes[0]
- assert attribute_with_reference["attribute"]["slug"] == "product-reference"
-
- assert len(attribute_with_reference["values"]) == 1
- value = attribute_with_reference["values"][0]
- assert value["reference"] == graphene.Node.to_global_id("Product", product.id)
- assert value["referencedObject"]["__typename"] == "Product"
- assert value["referencedObject"]["id"] == graphene.Node.to_global_id(
- "Product", product.id
- )
- # having pricing object means that we passed channel_slug to the product
- assert value["referencedObject"]["pricing"]
diff --git a/saleor/graphql/query_cost_map.py b/saleor/graphql/query_cost_map.py
index ba6a416a65..d70e5eb4fd 100644
--- a/saleor/graphql/query_cost_map.py
+++ b/saleor/graphql/query_cost_map.py
@@ -152,9 +152,6 @@ COST_MAP = {
"productTypes": {"complexity": 1, "multipliers": ["first", "last"]},
"productVariantTypes": {"complexity": 1, "multipliers": ["first", "last"]},
},
- "AttributeValue": {
- "referencedObject": {"complexity": 1},
- },
"Category": {
"ancestors": {"complexity": 1, "multipliers": ["first", "last"]},
"children": {"complexity": 1, "multipliers": ["first", "last"]},
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index eaf74301d5..2382897e63 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -6330,13 +6330,6 @@ type AttributeValue implements Node @doc(category: "Attributes") {
"""The ID of the referenced object."""
reference: ID
- """
- The object referenced by the attribute value.
-
- Added in Saleor 3.22.
- """
- referencedObject: AttributeValueReferencedObject
-
"""Represents file URL and content type (if attribute value is a file)."""
file: File
@@ -6464,11 +6457,206 @@ type AttributeTranslation implements Node @doc(category: "Attributes") {
translatableContent: AttributeTranslatableContent
}
-union AttributeValueReferencedObject = Product | ProductVariant | Page
+type File {
+ """The URL of the file."""
+ url: String!
+
+ """Content type of the file."""
+ contentType: String
+}
-"""Represents a version of a product such as different size or color."""
-type ProductVariant implements Node & ObjectWithMetadata @doc(category: "Products") {
- """The ID of the product variant."""
+"""
+The `Date` scalar type represents a Date
+value as specified by
+[iso8601](https://en.wikipedia.org/wiki/ISO_8601).
+"""
+scalar Date
+
+input AttributeChoicesSortingInput @doc(category: "Attributes") {
+ """Specifies the direction in which to sort attribute choices."""
+ direction: OrderDirection!
+
+ """Sort attribute choices by the selected field."""
+ field: AttributeChoicesSortField!
+}
+
+enum AttributeChoicesSortField @doc(category: "Attributes") {
+ """Sort attribute choice by name."""
+ NAME
+
+ """Sort attribute choice by slug."""
+ SLUG
+}
+
+input AttributeValueFilterInput @doc(category: "Attributes") {
+ search: String
+ ids: [ID!]
+ slugs: [String!]
+}
+
+"""Where filtering options for attribute values."""
+input AttributeValueWhereInput @doc(category: "Attributes") {
+ ids: [ID!]
+ name: StringFilterInput
+ slug: StringFilterInput
+
+ """List of conditions that must be met."""
+ AND: [AttributeValueWhereInput!]
+
+ """A list of conditions of which at least one must be met."""
+ OR: [AttributeValueWhereInput!]
+}
+
+"""Define the filtering options for string fields."""
+input StringFilterInput {
+ """The value equal to."""
+ eq: String
+
+ """The value included in."""
+ oneOf: [String!]
+}
+
+type ProductTypeCountableConnection @doc(category: "Products") {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [ProductTypeCountableEdge!]!
+
+ """A total count of items in the collection."""
+ totalCount: Int
+}
+
+type ProductTypeCountableEdge @doc(category: "Products") {
+ """The item at the end of the edge."""
+ node: ProductType!
+
+ """A cursor for use in pagination."""
+ cursor: String!
+}
+
+enum VariantAttributeScope @doc(category: "Products") {
+ ALL
+ VARIANT_SELECTION
+ NOT_VARIANT_SELECTION
+}
+
+"""
+Represents assigned attribute to variant with variant selection attached.
+"""
+type AssignedVariantAttribute @doc(category: "Attributes") {
+ """Attribute assigned to variant."""
+ attribute: Attribute!
+
+ """
+ Determines, whether assigned attribute is allowed for variant selection. Supported variant types for variant selection are: ['dropdown', 'boolean', 'swatch', 'numeric']
+ """
+ variantSelection: Boolean!
+}
+
+type AttributeCountableConnection @doc(category: "Attributes") {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [AttributeCountableEdge!]!
+
+ """A total count of items in the collection."""
+ totalCount: Int
+}
+
+type AttributeCountableEdge @doc(category: "Attributes") {
+ """The item at the end of the edge."""
+ node: Attribute!
+
+ """A cursor for use in pagination."""
+ cursor: String!
+}
+
+input AttributeFilterInput @doc(category: "Attributes") {
+ valueRequired: Boolean
+ isVariantOnly: Boolean
+ visibleInStorefront: Boolean
+ filterableInStorefront: Boolean
+ filterableInDashboard: Boolean
+ availableInGrid: Boolean
+ metadata: [MetadataFilter!]
+ search: String
+ ids: [ID!]
+ type: AttributeTypeEnum
+ inCollection: ID
+ inCategory: ID
+ slugs: [String!]
+
+ """Specifies the channel by which the data should be filtered."""
+ channel: String @deprecated(reason: "Use root-level channel argument instead.")
+}
+
+input MetadataFilter {
+ """Key of a metadata item."""
+ key: String!
+
+ """Value of a metadata item."""
+ value: String
+}
+
+"""Where filtering options."""
+input AttributeWhereInput @doc(category: "Attributes") {
+ metadata: [MetadataFilter!]
+ ids: [ID!]
+ name: StringFilterInput
+ slug: StringFilterInput
+ withChoices: Boolean
+ inputType: AttributeInputTypeEnumFilterInput
+ entityType: AttributeEntityTypeEnumFilterInput
+ type: AttributeTypeEnumFilterInput
+ unit: MeasurementUnitsEnumFilterInput
+ inCollection: ID
+ inCategory: ID
+ valueRequired: Boolean
+ visibleInStorefront: Boolean
+ filterableInDashboard: Boolean
+
+ """List of conditions that must be met."""
+ AND: [AttributeWhereInput!]
+
+ """A list of conditions of which at least one must be met."""
+ OR: [AttributeWhereInput!]
+}
+
+input AttributeInputTypeEnumFilterInput @doc(category: "Attributes") {
+ """The value equal to."""
+ eq: AttributeInputTypeEnum
+
+ """The value included in."""
+ oneOf: [AttributeInputTypeEnum!]
+}
+
+input AttributeEntityTypeEnumFilterInput @doc(category: "Attributes") {
+ """The value equal to."""
+ eq: AttributeEntityTypeEnum
+
+ """The value included in."""
+ oneOf: [AttributeEntityTypeEnum!]
+}
+
+input AttributeTypeEnumFilterInput @doc(category: "Attributes") {
+ """The value equal to."""
+ eq: AttributeTypeEnum
+
+ """The value included in."""
+ oneOf: [AttributeTypeEnum!]
+}
+
+input MeasurementUnitsEnumFilterInput @doc(category: "Attributes") {
+ """The value equal to."""
+ eq: MeasurementUnitsEnum
+
+ """The value included in."""
+ oneOf: [MeasurementUnitsEnum!]
+}
+
+"""
+Represents a single category of products. Categories allow to organize products in a tree-hierarchies which can be used for navigation in the storefront.
+"""
+type Category implements Node & ObjectWithMetadata @doc(category: "Products") {
+ """The ID of the category."""
id: ID!
"""List of private metadata items. Requires staff permissions to access."""
@@ -6501,882 +6689,548 @@ type ProductVariant implements Node & ObjectWithMetadata @doc(category: "Product
"""
metafields(keys: [String!]): Metadata
- """The name of the product variant."""
- name: String!
+ """SEO title of category."""
+ seoTitle: String
- """The SKU (stock keeping unit) of the product variant."""
- sku: String
+ """SEO description of category."""
+ seoDescription: String
- """The product to which the variant belongs."""
- product: Product!
+ """Name of category"""
+ name: String!
"""
- Determines if the inventory of this variant should be tracked. If false, the quantity won't change when customers buy this item. If the field is not provided, `Shop.trackInventoryByDefault` will be used.
+ Description of the category.
+
+ Rich text format. For reference see https://editorjs.io/
"""
- trackInventory: Boolean!
+ description: JSONString
- """The maximum quantity of this variant that a customer can purchase."""
- quantityLimitPerCustomer: Int
+ """Slug of the category."""
+ slug: String!
- """The weight of the product variant."""
- weight: Weight
+ """Parent category."""
+ parent: Category
- """
- Channel given to retrieve this product variant. Also used by federation gateway to resolve this object in a federated query.
- """
- channel: String
+ """Level of the category."""
+ level: Int!
"""
- List of price information in channels for the product.
+ Description of the category.
- Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
+ Rich text format. For reference see https://editorjs.io/
"""
- channelListings: [ProductVariantChannelListing!]
+ descriptionJson: JSONString @deprecated(reason: "Use the `description` field instead.")
- """
- Lists the storefront variant's pricing, the current price and discounts, only meant for displaying.
- """
- pricing(
- """
- Destination address used to find warehouses where stock availability for this product is checked. If address is empty, uses `Shop.companyAddress` or fallbacks to server's `settings.DEFAULT_COUNTRY` configuration.
- """
- address: AddressInput
- ): VariantPricingInfo
+ """The date and time when the category was last updated."""
+ updatedAt: DateTime!
- """List of attributes assigned to this variant."""
- attributes(
- """Define scope of returned attributes."""
- variantSelection: VariantAttributeScope
- ): [SelectedAttribute!]!
+ """List of ancestors of the category."""
+ ancestors(
+ """Return the elements in the list that come before the specified cursor."""
+ before: String
- """Gross margin percentage value."""
- margin: Int
+ """Return the elements in the list that come after the specified cursor."""
+ after: String
- """
- Total quantity ordered.
-
- Requires one of the following permissions: MANAGE_PRODUCTS.
- """
- quantityOrdered: Int
+ """
+ Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ first: Int
+
+ """
+ Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ last: Int
+ ): CategoryCountableConnection
"""
- Total revenue generated by a variant in given period of time. Note: this field should be queried using `reportProductSales` query as it uses optimizations suitable for such calculations.
-
- Requires one of the following permissions: MANAGE_PRODUCTS.
+ List of products in the category. Requires the following permissions to include the unpublished items: MANAGE_ORDERS, MANAGE_DISCOUNTS, MANAGE_PRODUCTS.
"""
- revenue(period: ReportingPeriod): TaxedMoney
+ products(
+ """Filtering options for products."""
+ filter: ProductFilterInput @deprecated(reason: "Use `where` filter instead.")
- """List of images for the product variant."""
- images: [ProductImage!] @deprecated(reason: "Use the `media` field instead.")
+ """Where filtering options for products."""
+ where: ProductWhereInput
- """List of media for the product variant."""
- media: [ProductMedia!]
+ """Sort products."""
+ sortBy: ProductOrder
- """Returns translated product variant fields for the given language code."""
- translation(
- """A language code to return the translation for product variant."""
- languageCode: LanguageCodeEnum!
- ): ProductVariantTranslation
+ """Search products."""
+ search: String
- """
- Digital content for the product variant.
-
- Requires one of the following permissions: MANAGE_PRODUCTS.
- """
- digitalContent: DigitalContent
+ """Slug of a channel for which the data should be returned."""
+ channel: String
+
+ """Return the elements in the list that come before the specified cursor."""
+ before: String
+
+ """Return the elements in the list that come after the specified cursor."""
+ after: String
- """
- Stocks for the product variant.
-
- Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
- """
- stocks(
"""
- Destination address used to find warehouses where stock availability for this product is checked. If address is empty, uses `Shop.companyAddress` or fallbacks to server's `settings.DEFAULT_COUNTRY` configuration.
+ Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
"""
- address: AddressInput
+ first: Int
- """Two-letter ISO 3166-1 country code."""
- countryCode: CountryCode @deprecated(reason: "Use `address` argument instead.")
- ): [Stock!]
+ """
+ Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ last: Int
+ ): ProductCountableConnection
+
+ """List of children of the category."""
+ children(
+ """Return the elements in the list that come before the specified cursor."""
+ before: String
+
+ """Return the elements in the list that come after the specified cursor."""
+ after: String
- """
- Quantity of a product available for sale in one checkout. Field value will be `null` when no `limitQuantityPerCheckout` in global settings has been set, and `productVariant` stocks are not tracked.
- """
- quantityAvailable(
"""
- Destination address used to find warehouses where stock availability for this product is checked. If address is empty, uses `Shop.companyAddress` or fallbacks to server's `settings.DEFAULT_COUNTRY` configuration.
+ Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
"""
- address: AddressInput
+ first: Int
"""
- Two-letter ISO 3166-1 country code. When provided, the exact quantity from a warehouse operating in shipping zones that contain this country will be returned. Otherwise, it will return the maximum quantity from all shipping zones.
+ Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
"""
- countryCode: CountryCode @deprecated(reason: "Use `address` argument instead.")
- ): Int
+ last: Int
+ ): CategoryCountableConnection
- """Preorder data for product variant."""
- preorder: PreorderData
+ """Background image of the category."""
+ backgroundImage(
+ """
+ Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended).
+ """
+ size: Int
- """The date and time when the product variant was created."""
- created: DateTime!
+ """
+ The format of the image. When not provided, format of the original image will be used.
+ """
+ format: ThumbnailFormatEnum = ORIGINAL
+ ): Image
- """The date and time when the product variant was last updated."""
- updatedAt: DateTime!
+ """Returns translated category fields for the given language code."""
+ translation(
+ """A language code to return the translation for category."""
+ languageCode: LanguageCodeEnum!
+ ): CategoryTranslation
+}
- """External ID of this product."""
- externalReference: String
+type CategoryCountableConnection @doc(category: "Products") {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [CategoryCountableEdge!]!
+
+ """A total count of items in the collection."""
+ totalCount: Int
}
-"""Represents product variant channel listing."""
-type ProductVariantChannelListing implements Node @doc(category: "Products") {
- """The ID of the variant channel listing."""
- id: ID!
+type CategoryCountableEdge @doc(category: "Products") {
+ """The item at the end of the edge."""
+ node: Category!
- """The channel to which the variant listing belongs."""
- channel: Channel!
+ """A cursor for use in pagination."""
+ cursor: String!
+}
- """The price of the variant."""
- price: Money
+input ProductFilterInput @doc(category: "Products") {
+ isPublished: Boolean
+ collections: [ID!]
+ categories: [ID!]
+ hasCategory: Boolean
+ attributes: [AttributeInput!]
- """Cost price of the variant."""
- costPrice: Money
+ """Filter by variants having specific stock status."""
+ stockAvailability: StockAvailability
+ stocks: ProductStockFilterInput
+ search: String
+ metadata: [MetadataFilter!]
- """
- Prior price of the variant used for discount calculations.
-
- Added in Saleor 3.21.
- """
- priorPrice: Money
+ """Filter by the publication date."""
+ publishedFrom: DateTime
- """
- Gross margin percentage value.
-
- Requires one of the following permissions: MANAGE_PRODUCTS.
- """
- margin: Int
+ """Filter by availability for purchase."""
+ isAvailable: Boolean
- """Preorder variant data."""
- preorderThreshold: PreorderThreshold
-}
+ """Filter by the date of availability for purchase."""
+ availableFrom: DateTime
-"""Represents preorder variant data for channel."""
-type PreorderThreshold @doc(category: "Products") {
- """Preorder threshold for product variant in this channel."""
- quantity: Int
+ """Filter by visibility in product listings."""
+ isVisibleInListing: Boolean
+ price: PriceRangeInput
- """Number of sold product variant in this channel."""
- soldUnits: Int!
-}
+ """Filter by the lowest variant price after discounts."""
+ minimalPrice: PriceRangeInput
-"""Represents availability of a variant in the storefront."""
-type VariantPricingInfo @doc(category: "Products") {
- """Whether it is in sale or not."""
- onSale: Boolean
+ """Filter by when was the most recent update."""
+ updatedAt: DateTimeRangeInput
+ productTypes: [ID!]
- """The discount amount if in sale (null otherwise)."""
- discount: TaxedMoney
+ """Filter on whether product is a gift card or not."""
+ giftCard: Boolean
+ ids: [ID!]
+ hasPreorderedVariants: Boolean
+ slugs: [String!]
+
+ """Specifies the channel by which the data should be filtered."""
+ channel: String @deprecated(reason: "Use root-level channel argument instead.")
+}
+
+input AttributeInput @doc(category: "Attributes") {
+ """Internal representation of an attribute name."""
+ slug: String
"""
- The discount amount compared to prior price. Null if product is not on sale or prior price was not provided in VariantChannelListing
-
- Added in Saleor 3.21.
+ Filter by value of the attribute. Only one value input field is allowed. If provided more than one, the error will be raised. Cannot be combined with deprecated fields of `AttributeInput`.
"""
- discountPrior: TaxedMoney
+ value: AssignedAttributeValueInput
- """The discount amount in the local currency."""
- discountLocalCurrency: TaxedMoney @deprecated(reason: "Always returns `null`.")
+ """
+ Slugs identifying the attributeValues associated with the Attribute. When specified, it filters the results to include only records with one of the matching values. Requires `slug` to be provided.
+ """
+ values: [String!] @deprecated(reason: "Use `value` instead.")
- """The price, with any discount subtracted."""
- price: TaxedMoney
+ """
+ The range that the returned values should be in. Requires `slug` to be provided.
+ """
+ valuesRange: IntRangeInput @deprecated(reason: "Use `value` instead.")
- """The price without any discount."""
- priceUndiscounted: TaxedMoney
+ """
+ The date/time range that the returned values should be in. Requires `slug` to be provided.
+ """
+ dateTime: DateTimeRangeInput @deprecated(reason: "Use `value` instead.")
"""
- The price prior to discount.
-
- Added in Saleor 3.21.
+ The date range that the returned values should be in. In case of date/time attributes, the UTC midnight of the given date is used. Requires `slug` to be provided.
"""
- pricePrior: TaxedMoney
+ date: DateRangeInput @deprecated(reason: "Use `value` instead.")
- """The discounted price in the local currency."""
- priceLocalCurrency: TaxedMoney @deprecated(reason: "Always returns `null`.")
+ """The boolean value of the attribute. Requires `slug` to be provided."""
+ boolean: Boolean @deprecated(reason: "Use `value` instead.")
}
-"""
-Represents a monetary value with taxes. In cases where taxes were not applied, net and gross values will be equal.
-"""
-type TaxedMoney {
- """Currency code."""
- currency: String!
+input AssignedAttributeValueInput {
+ """Filter by slug assigned to AttributeValue."""
+ slug: StringFilterInput
- """Amount of money including taxes."""
- gross: Money!
+ """Filter by name assigned to AttributeValue."""
+ name: StringFilterInput
- """Amount of money without taxes."""
- net: Money!
+ """Filter by numeric value for attributes of numeric type."""
+ numeric: DecimalFilterInput
- """Amount of taxes."""
- tax: Money!
+ """Filter by date value for attributes of date type."""
+ date: DateRangeInput
+
+ """Filter by date time value for attributes of date time type."""
+ dateTime: DateTimeRangeInput
+
+ """Filter by boolean value for attributes of boolean type."""
+ boolean: Boolean
+
+ """Filter by reference attribute value."""
+ reference: AssignedAttributeReferenceInput
}
-input AddressInput {
- """Given name."""
- firstName: String
+"""Define the filtering options for decimal fields."""
+input DecimalFilterInput {
+ """The value equal to."""
+ eq: Decimal
- """Family name."""
- lastName: String
+ """The value included in."""
+ oneOf: [Decimal!]
- """Company or organization."""
- companyName: String
+ """The value in range."""
+ range: DecimalRangeInput
+}
- """Address."""
- streetAddress1: String
+"""
+Custom Decimal implementation.
- """Address."""
- streetAddress2: String
+Returns Decimal as a float in the API,
+parses float to the Decimal on the way back.
+"""
+scalar Decimal
- """City."""
- city: String
+input DecimalRangeInput {
+ """Decimal value greater than or equal to."""
+ gte: Decimal
- """District."""
- cityArea: String
+ """Decimal value less than or equal to."""
+ lte: Decimal
+}
- """Postal code."""
- postalCode: String
+input DateRangeInput {
+ """Start date."""
+ gte: Date
- """Country."""
- country: CountryCode
+ """End date."""
+ lte: Date
+}
- """State or province."""
- countryArea: String
+input DateTimeRangeInput {
+ """Start date."""
+ gte: DateTime
+
+ """End date."""
+ lte: DateTime
+}
+input AssignedAttributeReferenceInput {
"""
- Phone number.
-
- Phone numbers are validated with Google's [libphonenumber](https://github.com/google/libphonenumber) library.
+ Returns objects with a reference pointing to an object identified by the given ID.
"""
- phone: String
+ referencedIds: ContainsFilterInput
"""
- Address public metadata. Can be read by any API client authorized to read the object it's attached to.
-
- Warning: never store sensitive information, including financial data such as credit card details.
+ Returns objects with a reference pointing to a page identified by the given slug.
"""
- metadata: [MetadataInput!]
+ pageSlugs: ContainsFilterInput
"""
- Determine if the address should be validated. By default, Saleor accepts only address inputs matching ruleset from [Google Address Data]{https://chromium-i18n.appspot.com/ssl-address), using [i18naddress](https://github.com/mirumee/google-i18n-address) library. Some mutations may require additional permissions to use the the field. More info about permissions can be found in relevant mutation.
-
- Added in Saleor 3.19.
-
- Note: this API is currently in Feature Preview and can be subject to changes at later point.
+ Returns objects with a reference pointing to a product identified by the given slug.
"""
- skipValidation: Boolean = false
+ productSlugs: ContainsFilterInput
+
+ """
+ Returns objects with a reference pointing to a product variant identified by the given sku.
+ """
+ productVariantSkus: ContainsFilterInput
}
-input MetadataInput {
- """Key of a metadata item."""
- key: String!
+"""
+Define the filtering options for fields that can contain multiple values.
+"""
+input ContainsFilterInput {
+ """The field contains at least one of the specified values."""
+ containsAny: [String!]
- """Value of a metadata item."""
- value: String!
+ """The field contains all of the specified values."""
+ containsAll: [String!]
}
-"""Represents a custom attribute."""
-type SelectedAttribute @doc(category: "Attributes") {
- """Name of an attribute displayed in the interface."""
- attribute: Attribute!
+input IntRangeInput {
+ """Value greater than or equal to."""
+ gte: Int
- """Values of an attribute."""
- values: [AttributeValue!]!
+ """Value less than or equal to."""
+ lte: Int
}
-enum VariantAttributeScope @doc(category: "Products") {
- ALL
- VARIANT_SELECTION
- NOT_VARIANT_SELECTION
+enum StockAvailability @doc(category: "Products") {
+ IN_STOCK
+ OUT_OF_STOCK
}
-enum ReportingPeriod {
- TODAY
- THIS_MONTH
+input ProductStockFilterInput @doc(category: "Products") {
+ warehouseIds: [ID!]
+ quantity: IntRangeInput
}
-"""Represents a product image."""
-type ProductImage @doc(category: "Products") {
- """The ID of the image."""
- id: ID!
+input PriceRangeInput {
+ """Price greater than or equal to."""
+ gte: Float
- """The alt text of the image."""
- alt: String
+ """Price less than or equal to."""
+ lte: Float
+}
- """
- The new relative sorting position of the item (from -inf to +inf). 1 moves the item one position forward, -1 moves the item one position backward, 0 leaves the item unchanged.
- """
- sortOrder: Int
+input ProductWhereInput @doc(category: "Products") {
+ metadata: [MetadataFilter!]
+ ids: [ID!]
- """The URL of the image."""
- url(
- """
- Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended).
- """
- size: Int
+ """Filter by product name."""
+ name: StringFilterInput
- """
- The format of the image. When not provided, format of the original image will be used.
- """
- format: ThumbnailFormatEnum = ORIGINAL
- ): String!
-}
+ """Filter by product slug."""
+ slug: StringFilterInput
-enum ThumbnailFormatEnum {
- ORIGINAL
- AVIF
- WEBP
-}
+ """Filter by product type."""
+ productType: GlobalIDFilterInput
-"""Represents a product media."""
-type ProductMedia implements Node & ObjectWithMetadata @doc(category: "Products") {
- """The unique ID of the product media."""
- id: ID!
+ """Filter by product category."""
+ category: GlobalIDFilterInput
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
+ """Filter by collection."""
+ collection: GlobalIDFilterInput
- """
- A single key from private metadata. Requires staff permissions to access.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- privateMetafield(key: String!): String
+ """Filter by availability for purchase."""
+ isAvailable: Boolean
- """
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- privateMetafields(keys: [String!]): Metadata
+ """Filter by public visibility."""
+ isPublished: Boolean
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
+ """Filter by visibility on the channel."""
+ isVisibleInListing: Boolean
- """
- A single key from public metadata.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- metafield(key: String!): String
+ """Filter by the publication date."""
+ publishedFrom: DateTime
- """
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- metafields(keys: [String!]): Metadata
+ """Filter by the date of availability for purchase."""
+ availableFrom: DateTime
- """The sort order of the media."""
- sortOrder: Int
+ """Filter by product with category assigned."""
+ hasCategory: Boolean
- """The alt text of the media."""
- alt: String!
+ """Filter by product variant price."""
+ price: DecimalFilterInput
- """The type of the media."""
- type: ProductMediaType!
+ """Filter by the lowest variant price after discounts."""
+ minimalPrice: DecimalFilterInput
- """The oEmbed data of the media."""
- oembedData: JSONString!
+ """Filter by attributes associated with the product."""
+ attributes: [AttributeInput!]
- """The URL of the media."""
- url(
- """
- Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended).
- """
- size: Int
+ """Filter by variants having specific stock status."""
+ stockAvailability: StockAvailability
- """
- The format of the image. When not provided, format of the original image will be used.
- """
- format: ThumbnailFormatEnum = ORIGINAL
- ): String!
-
- """Product id the media refers to."""
- productId: ID
-}
-
-enum ProductMediaType @doc(category: "Products") {
- IMAGE
- VIDEO
-}
-
-"""Represents product variant translations."""
-type ProductVariantTranslation implements Node @doc(category: "Products") {
- """The ID of the product variant translation."""
- id: ID!
-
- """Translation language."""
- language: LanguageDisplay!
-
- """Translated product variant name."""
- name: String!
-
- """Represents the product variant fields to translate."""
- translatableContent: ProductVariantTranslatableContent
-}
-
-"""
-Represents product variant's original translatable fields and related translations.
-"""
-type ProductVariantTranslatableContent implements Node @doc(category: "Products") {
- """The ID of the product variant translatable content."""
- id: ID!
+ """Filter by stock of the product variant."""
+ stocks: ProductStockFilterInput
- """The ID of the product variant to translate."""
- productVariantId: ID!
+ """Filter on whether product is a gift card or not."""
+ giftCard: Boolean
- """Name of the product variant to translate."""
- name: String!
+ """Filter by product with preordered variants."""
+ hasPreorderedVariants: Boolean
- """Returns translated product variant fields for the given language code."""
- translation(
- """A language code to return the translation for product variant."""
- languageCode: LanguageCodeEnum!
- ): ProductVariantTranslation
+ """Filter by when was the most recent update."""
+ updatedAt: DateTimeFilterInput
- """Represents a version of a product such as different size or color."""
- productVariant: ProductVariant @deprecated(reason: "Get model fields from the root level queries.")
+ """List of conditions that must be met."""
+ AND: [ProductWhereInput!]
- """List of product variant attribute values that can be translated."""
- attributeValues: [AttributeValueTranslatableContent!]!
+ """A list of conditions of which at least one must be met."""
+ OR: [ProductWhereInput!]
}
-"""Represents digital content associated with a product variant."""
-type DigitalContent implements Node & ObjectWithMetadata @doc(category: "Products") {
- """The ID of the digital content."""
- id: ID!
-
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
-
- """
- A single key from private metadata. Requires staff permissions to access.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- privateMetafield(key: String!): String
-
- """
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- privateMetafields(keys: [String!]): Metadata
-
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
-
- """
- A single key from public metadata.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- metafield(key: String!): String
-
- """
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- metafields(keys: [String!]): Metadata
-
- """Default settings indicator for digital content."""
- useDefaultSettings: Boolean!
-
- """Indicator for automatic fulfillment of digital content."""
- automaticFulfillment: Boolean!
-
- """File associated with digital content."""
- contentFile: String!
-
- """Maximum number of allowed downloads for the digital content."""
- maxDownloads: Int
-
- """Number of days the URL for the digital content remains valid."""
- urlValidDays: Int
-
- """List of URLs for the digital variant."""
- urls: [DigitalContentUrl!]
+"""Define the filtering options for foreign key fields."""
+input GlobalIDFilterInput {
+ """The value equal to."""
+ eq: ID
- """Product variant assigned to digital content."""
- productVariant: ProductVariant!
+ """The value included in."""
+ oneOf: [ID!]
}
-"""Represents a URL for digital content."""
-type DigitalContentUrl implements Node @doc(category: "Products") {
- """The ID of the digital content URL."""
- id: ID!
-
- """Digital content associated with the URL."""
- content: DigitalContent!
-
- """Date and time when the digital content URL was created."""
- created: DateTime!
-
- """Number of times digital content has been downloaded."""
- downloadNum: Int!
+"""Define the filtering options for date time fields."""
+input DateTimeFilterInput {
+ """The value equal to."""
+ eq: DateTime
- """URL for digital content."""
- url: String
+ """The value included in."""
+ oneOf: [DateTime!]
- """UUID of digital content."""
- token: UUID!
+ """The value in range."""
+ range: DateTimeRangeInput
}
-scalar UUID
-
-"""Represents stock."""
-type Stock implements Node @doc(category: "Products") {
- """The ID of stock."""
- id: ID!
-
- """The warehouse associated with the stock."""
- warehouse: Warehouse!
-
- """Information about the product variant."""
- productVariant: ProductVariant!
-
- """
- Quantity of a product in the warehouse's possession, including the allocated stock that is waiting for shipment.
-
- Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
- """
- quantity: Int!
-
- """
- Quantity allocated for orders.
-
- Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
- """
- quantityAllocated: Int!
-
- """
- Quantity reserved for checkouts.
-
- Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
- """
- quantityReserved: Int!
-}
+input ProductOrder @doc(category: "Products") {
+ """Specifies the direction in which to sort products."""
+ direction: OrderDirection!
-"""Represents preorder settings for product variant."""
-type PreorderData @doc(category: "Products") {
- """
- The global preorder threshold for product variant.
-
- Requires one of the following permissions: MANAGE_PRODUCTS.
- """
- globalThreshold: Int
+ """Specifies the channel in which to sort the data."""
+ channel: String @deprecated(reason: "Use root-level channel argument instead.")
"""
- Total number of sold product variant during preorder.
-
- Requires one of the following permissions: MANAGE_PRODUCTS.
+ Sort product by the selected attribute's values.
+ Note: this doesn't take translations into account yet.
"""
- globalSoldUnits: Int!
+ attributeId: ID
- """Preorder end date."""
- endDate: DateTime
+ """Sort products by the selected field."""
+ field: ProductOrderField
}
-"""
-A static page that can be manually added by a shop operator through the dashboard.
-"""
-type Page implements Node & ObjectWithMetadata @doc(category: "Pages") {
- """ID of the page."""
- id: ID!
-
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
-
- """
- A single key from private metadata. Requires staff permissions to access.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- privateMetafield(key: String!): String
-
- """
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- privateMetafields(keys: [String!]): Metadata
-
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
-
- """
- A single key from public metadata.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- metafield(key: String!): String
-
- """
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- metafields(keys: [String!]): Metadata
-
- """Title of the page for SEO."""
- seoTitle: String
-
- """Description of the page for SEO."""
- seoDescription: String
-
- """Title of the page."""
- title: String!
-
- """
- Content of the page.
-
- Rich text format. For reference see https://editorjs.io/
- """
- content: JSONString
- publicationDate: Date @deprecated(reason: "Use the `publishedAt` field to fetch the publication date.")
-
- """The page publication date."""
- publishedAt: DateTime
-
- """Determines if the page is published."""
- isPublished: Boolean!
-
- """Slug of the page."""
- slug: String!
-
- """Determines the type of page"""
- pageType: PageType!
-
- """Date and time at which page was created."""
- created: DateTime!
+enum ProductOrderField @doc(category: "Products") {
+ """Sort products by name."""
+ NAME
"""
- Content of the page.
-
- Rich text format. For reference see https://editorjs.io/
+ Sort products by rank. Note: This option is available only with the `search` filter.
"""
- contentJson: JSONString! @deprecated(reason: "Use the `content` field instead.")
-
- """Returns translated page fields for the given language code."""
- translation(
- """A language code to return the translation for page."""
- languageCode: LanguageCodeEnum!
- ): PageTranslation
-
- """Get a single attribute attached to page by attribute slug."""
- attribute(
- """Slug of the attribute"""
- slug: String!
- ): SelectedAttribute
-
- """List of attributes assigned to this page."""
- attributes: [SelectedAttribute!]!
-}
-
-"""
-The `Date` scalar type represents a Date
-value as specified by
-[iso8601](https://en.wikipedia.org/wiki/ISO_8601).
-"""
-scalar Date
-
-"""
-Represents a type of page. It defines what attributes are available to pages of this type.
-"""
-type PageType implements Node & ObjectWithMetadata @doc(category: "Pages") {
- """ID of the page type."""
- id: ID!
-
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
+ RANK
"""
- A single key from private metadata. Requires staff permissions to access.
+ Sort products by price.
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- privateMetafield(key: String!): String
-
- """
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ This option requires a channel filter to work as the values can vary between channels.
"""
- privateMetafields(keys: [String!]): Metadata
-
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
+ PRICE
"""
- A single key from public metadata.
+ Sort products by a minimal price of a product's variant.
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- metafield(key: String!): String
-
- """
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ This option requires a channel filter to work as the values can vary between channels.
"""
- metafields(keys: [String!]): Metadata
+ MINIMAL_PRICE
- """Name of the page type."""
- name: String!
+ """Sort products by update date."""
+ LAST_MODIFIED @deprecated(reason: "Use `LAST_MODIFIED_AT` instead.")
- """Slug of the page type."""
- slug: String!
+ """Sort products by update date."""
+ DATE @deprecated(reason: "Use `LAST_MODIFIED_AT` instead.")
- """Page attributes of that page type."""
- attributes: [Attribute!]
+ """Sort products by type."""
+ TYPE
"""
- Attributes that can be assigned to the page type.
+ Sort products by publication status.
- Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES.
+ This option requires a channel filter to work as the values can vary between channels.
"""
- availableAttributes(
- """Filtering options for attributes."""
- filter: AttributeFilterInput @deprecated(reason: "Use `where` filter instead.")
-
- """Where filtering options for attributes."""
- where: AttributeWhereInput
-
- """Search attributes."""
- search: String
-
- """Return the elements in the list that come before the specified cursor."""
- before: String
-
- """Return the elements in the list that come after the specified cursor."""
- after: String
-
- """
- Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- first: Int
-
- """
- Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- last: Int
- ): AttributeCountableConnection
+ PUBLISHED
"""
- Whether page type has pages assigned.
-
- Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES.
- """
- hasPages: Boolean
-}
-
-type AttributeCountableConnection @doc(category: "Attributes") {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [AttributeCountableEdge!]!
-
- """A total count of items in the collection."""
- totalCount: Int
-}
-
-type AttributeCountableEdge @doc(category: "Attributes") {
- """The item at the end of the edge."""
- node: Attribute!
-
- """A cursor for use in pagination."""
- cursor: String!
-}
-
-input AttributeFilterInput @doc(category: "Attributes") {
- valueRequired: Boolean
- isVariantOnly: Boolean
- visibleInStorefront: Boolean
- filterableInStorefront: Boolean
- filterableInDashboard: Boolean
- availableInGrid: Boolean
- metadata: [MetadataFilter!]
- search: String
- ids: [ID!]
- type: AttributeTypeEnum
- inCollection: ID
- inCategory: ID
- slugs: [String!]
-
- """Specifies the channel by which the data should be filtered."""
- channel: String @deprecated(reason: "Use root-level channel argument instead.")
-}
-
-input MetadataFilter {
- """Key of a metadata item."""
- key: String!
-
- """Value of a metadata item."""
- value: String
-}
-
-"""Where filtering options."""
-input AttributeWhereInput @doc(category: "Attributes") {
- metadata: [MetadataFilter!]
- ids: [ID!]
- name: StringFilterInput
- slug: StringFilterInput
- withChoices: Boolean
- inputType: AttributeInputTypeEnumFilterInput
- entityType: AttributeEntityTypeEnumFilterInput
- type: AttributeTypeEnumFilterInput
- unit: MeasurementUnitsEnumFilterInput
- inCollection: ID
- inCategory: ID
- valueRequired: Boolean
- visibleInStorefront: Boolean
- filterableInDashboard: Boolean
-
- """List of conditions that must be met."""
- AND: [AttributeWhereInput!]
-
- """A list of conditions of which at least one must be met."""
- OR: [AttributeWhereInput!]
-}
-
-"""Define the filtering options for string fields."""
-input StringFilterInput {
- """The value equal to."""
- eq: String
+ Sort products by publication date.
+
+ This option requires a channel filter to work as the values can vary between channels.
+ """
+ PUBLICATION_DATE @deprecated(reason: "Use `PUBLISHED_AT` instead.")
- """The value included in."""
- oneOf: [String!]
-}
+ """
+ Sort products by publication date.
+
+ This option requires a channel filter to work as the values can vary between channels.
+ """
+ PUBLISHED_AT
-input AttributeInputTypeEnumFilterInput @doc(category: "Attributes") {
- """The value equal to."""
- eq: AttributeInputTypeEnum
+ """Sort products by update date."""
+ LAST_MODIFIED_AT
- """The value included in."""
- oneOf: [AttributeInputTypeEnum!]
-}
+ """
+ Sort products by collection. Note: This option is available only for the `Collection.products` query.
+
+ This option requires a channel filter to work as the values can vary between channels.
+ """
+ COLLECTION
-input AttributeEntityTypeEnumFilterInput @doc(category: "Attributes") {
- """The value equal to."""
- eq: AttributeEntityTypeEnum
+ """Sort products by rating."""
+ RATING
- """The value included in."""
- oneOf: [AttributeEntityTypeEnum!]
+ """Sort products by creation date."""
+ CREATED_AT
}
-input AttributeTypeEnumFilterInput @doc(category: "Attributes") {
- """The value equal to."""
- eq: AttributeTypeEnum
+"""Represents an image."""
+type Image {
+ """The URL of the image."""
+ url: String!
- """The value included in."""
- oneOf: [AttributeTypeEnum!]
+ """Alt text for an image."""
+ alt: String
}
-input MeasurementUnitsEnumFilterInput @doc(category: "Attributes") {
- """The value equal to."""
- eq: MeasurementUnitsEnum
-
- """The value included in."""
- oneOf: [MeasurementUnitsEnum!]
+enum ThumbnailFormatEnum {
+ ORIGINAL
+ AVIF
+ WEBP
}
-"""Represents page translations."""
-type PageTranslation implements Node @doc(category: "Pages") {
- """The ID of the page translation."""
+"""Represents category translations."""
+type CategoryTranslation implements Node @doc(category: "Products") {
+ """The ID of the category translation."""
id: ID!
"""Translation language."""
@@ -7389,42 +7243,42 @@ type PageTranslation implements Node @doc(category: "Pages") {
seoDescription: String
"""
- Translated page slug.
+ Translated category slug.
Added in Saleor 3.21.
"""
slug: String
- """Translated page title."""
- title: String
+ """Translated category name."""
+ name: String
"""
- Translated content of the page.
+ Translated description of the category.
Rich text format. For reference see https://editorjs.io/
"""
- content: JSONString
+ description: JSONString
"""
- Translated description of the page.
+ Translated description of the category.
Rich text format. For reference see https://editorjs.io/
"""
- contentJson: JSONString @deprecated(reason: "Use the `content` field instead.")
+ descriptionJson: JSONString @deprecated(reason: "Use the `description` field instead.")
- """Represents the page fields to translate."""
- translatableContent: PageTranslatableContent
+ """Represents the category fields to translate."""
+ translatableContent: CategoryTranslatableContent
}
"""
-Represents page's original translatable fields and related translations.
+Represents category original translatable fields and related translations.
"""
-type PageTranslatableContent implements Node @doc(category: "Pages") {
- """The ID of the page translatable content."""
+type CategoryTranslatableContent implements Node @doc(category: "Products") {
+ """The ID of the category translatable content."""
id: ID!
- """The ID of the page to translate."""
- pageId: ID!
+ """The ID of the category to translate."""
+ categoryId: ID!
"""SEO title to translate."""
seoTitle: String
@@ -7439,771 +7293,633 @@ type PageTranslatableContent implements Node @doc(category: "Pages") {
"""
slug: String
- """Page title to translate."""
- title: String!
+ """Name of the category translatable content."""
+ name: String!
"""
- Content of the page to translate.
+ Category description to translate.
Rich text format. For reference see https://editorjs.io/
"""
- content: JSONString
+ description: JSONString
"""
- Content of the page.
+ Description of the category.
Rich text format. For reference see https://editorjs.io/
"""
- contentJson: JSONString @deprecated(reason: "Use the `content` field instead.")
+ descriptionJson: JSONString @deprecated(reason: "Use the `description` field instead.")
- """Returns translated page fields for the given language code."""
+ """Returns translated category fields for the given language code."""
translation(
- """A language code to return the translation for page."""
+ """A language code to return the translation for category."""
languageCode: LanguageCodeEnum!
- ): PageTranslation
-
- """
- A static page that can be manually added by a shop operator through the dashboard.
- """
- page: Page @deprecated(reason: "Get model fields from the root level queries.")
-
- """List of page content attribute values that can be translated."""
- attributeValues: [AttributeValueTranslatableContent!]!
-}
-
-type File {
- """The URL of the file."""
- url: String!
+ ): CategoryTranslation
- """Content type of the file."""
- contentType: String
+ """Represents a single category of products."""
+ category: Category @deprecated(reason: "Get model fields from the root level queries.")
}
-input AttributeChoicesSortingInput @doc(category: "Attributes") {
- """Specifies the direction in which to sort attribute choices."""
- direction: OrderDirection!
+"""Represents a version of a product such as different size or color."""
+type ProductVariant implements Node & ObjectWithMetadata @doc(category: "Products") {
+ """The ID of the product variant."""
+ id: ID!
- """Sort attribute choices by the selected field."""
- field: AttributeChoicesSortField!
-}
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
-enum AttributeChoicesSortField @doc(category: "Attributes") {
- """Sort attribute choice by name."""
- NAME
+ """
+ A single key from private metadata. Requires staff permissions to access.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ privateMetafield(key: String!): String
- """Sort attribute choice by slug."""
- SLUG
-}
+ """
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ privateMetafields(keys: [String!]): Metadata
-input AttributeValueFilterInput @doc(category: "Attributes") {
- search: String
- ids: [ID!]
- slugs: [String!]
-}
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
-"""Where filtering options for attribute values."""
-input AttributeValueWhereInput @doc(category: "Attributes") {
- ids: [ID!]
- name: StringFilterInput
- slug: StringFilterInput
+ """
+ A single key from public metadata.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ metafield(key: String!): String
- """List of conditions that must be met."""
- AND: [AttributeValueWhereInput!]
+ """
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ metafields(keys: [String!]): Metadata
- """A list of conditions of which at least one must be met."""
- OR: [AttributeValueWhereInput!]
-}
+ """The name of the product variant."""
+ name: String!
-type ProductTypeCountableConnection @doc(category: "Products") {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [ProductTypeCountableEdge!]!
+ """The SKU (stock keeping unit) of the product variant."""
+ sku: String
- """A total count of items in the collection."""
- totalCount: Int
-}
+ """The product to which the variant belongs."""
+ product: Product!
-type ProductTypeCountableEdge @doc(category: "Products") {
- """The item at the end of the edge."""
- node: ProductType!
+ """
+ Determines if the inventory of this variant should be tracked. If false, the quantity won't change when customers buy this item. If the field is not provided, `Shop.trackInventoryByDefault` will be used.
+ """
+ trackInventory: Boolean!
- """A cursor for use in pagination."""
- cursor: String!
-}
+ """The maximum quantity of this variant that a customer can purchase."""
+ quantityLimitPerCustomer: Int
-"""
-Represents assigned attribute to variant with variant selection attached.
-"""
-type AssignedVariantAttribute @doc(category: "Attributes") {
- """Attribute assigned to variant."""
- attribute: Attribute!
+ """The weight of the product variant."""
+ weight: Weight
"""
- Determines, whether assigned attribute is allowed for variant selection. Supported variant types for variant selection are: ['dropdown', 'boolean', 'swatch', 'numeric']
+ Channel given to retrieve this product variant. Also used by federation gateway to resolve this object in a federated query.
"""
- variantSelection: Boolean!
-}
-
-"""
-Represents a single category of products. Categories allow to organize products in a tree-hierarchies which can be used for navigation in the storefront.
-"""
-type Category implements Node & ObjectWithMetadata @doc(category: "Products") {
- """The ID of the category."""
- id: ID!
-
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
+ channel: String
"""
- A single key from private metadata. Requires staff permissions to access.
+ List of price information in channels for the product.
- Tip: Use GraphQL aliases to fetch multiple keys.
+ Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
"""
- privateMetafield(key: String!): String
+ channelListings: [ProductVariantChannelListing!]
"""
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ Lists the storefront variant's pricing, the current price and discounts, only meant for displaying.
"""
- privateMetafields(keys: [String!]): Metadata
+ pricing(
+ """
+ Destination address used to find warehouses where stock availability for this product is checked. If address is empty, uses `Shop.companyAddress` or fallbacks to server's `settings.DEFAULT_COUNTRY` configuration.
+ """
+ address: AddressInput
+ ): VariantPricingInfo
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
+ """List of attributes assigned to this variant."""
+ attributes(
+ """Define scope of returned attributes."""
+ variantSelection: VariantAttributeScope
+ ): [SelectedAttribute!]!
+
+ """Gross margin percentage value."""
+ margin: Int
"""
- A single key from public metadata.
+ Total quantity ordered.
- Tip: Use GraphQL aliases to fetch multiple keys.
+ Requires one of the following permissions: MANAGE_PRODUCTS.
"""
- metafield(key: String!): String
+ quantityOrdered: Int
"""
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ Total revenue generated by a variant in given period of time. Note: this field should be queried using `reportProductSales` query as it uses optimizations suitable for such calculations.
+
+ Requires one of the following permissions: MANAGE_PRODUCTS.
"""
- metafields(keys: [String!]): Metadata
+ revenue(period: ReportingPeriod): TaxedMoney
- """SEO title of category."""
- seoTitle: String
+ """List of images for the product variant."""
+ images: [ProductImage!] @deprecated(reason: "Use the `media` field instead.")
- """SEO description of category."""
- seoDescription: String
+ """List of media for the product variant."""
+ media: [ProductMedia!]
- """Name of category"""
- name: String!
+ """Returns translated product variant fields for the given language code."""
+ translation(
+ """A language code to return the translation for product variant."""
+ languageCode: LanguageCodeEnum!
+ ): ProductVariantTranslation
"""
- Description of the category.
+ Digital content for the product variant.
- Rich text format. For reference see https://editorjs.io/
+ Requires one of the following permissions: MANAGE_PRODUCTS.
"""
- description: JSONString
-
- """Slug of the category."""
- slug: String!
-
- """Parent category."""
- parent: Category
-
- """Level of the category."""
- level: Int!
+ digitalContent: DigitalContent
"""
- Description of the category.
+ Stocks for the product variant.
- Rich text format. For reference see https://editorjs.io/
+ Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
"""
- descriptionJson: JSONString @deprecated(reason: "Use the `description` field instead.")
-
- """The date and time when the category was last updated."""
- updatedAt: DateTime!
-
- """List of ancestors of the category."""
- ancestors(
- """Return the elements in the list that come before the specified cursor."""
- before: String
-
- """Return the elements in the list that come after the specified cursor."""
- after: String
-
+ stocks(
"""
- Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ Destination address used to find warehouses where stock availability for this product is checked. If address is empty, uses `Shop.companyAddress` or fallbacks to server's `settings.DEFAULT_COUNTRY` configuration.
"""
- first: Int
+ address: AddressInput
- """
- Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- last: Int
- ): CategoryCountableConnection
+ """Two-letter ISO 3166-1 country code."""
+ countryCode: CountryCode @deprecated(reason: "Use `address` argument instead.")
+ ): [Stock!]
"""
- List of products in the category. Requires the following permissions to include the unpublished items: MANAGE_ORDERS, MANAGE_DISCOUNTS, MANAGE_PRODUCTS.
+ Quantity of a product available for sale in one checkout. Field value will be `null` when no `limitQuantityPerCheckout` in global settings has been set, and `productVariant` stocks are not tracked.
"""
- products(
- """Filtering options for products."""
- filter: ProductFilterInput @deprecated(reason: "Use `where` filter instead.")
-
- """Where filtering options for products."""
- where: ProductWhereInput
-
- """Sort products."""
- sortBy: ProductOrder
-
- """Search products."""
- search: String
-
- """Slug of a channel for which the data should be returned."""
- channel: String
-
- """Return the elements in the list that come before the specified cursor."""
- before: String
-
- """Return the elements in the list that come after the specified cursor."""
- after: String
-
- """
- Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- first: Int
-
- """
- Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- last: Int
- ): ProductCountableConnection
-
- """List of children of the category."""
- children(
- """Return the elements in the list that come before the specified cursor."""
- before: String
-
- """Return the elements in the list that come after the specified cursor."""
- after: String
-
- """
- Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- first: Int
-
- """
- Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- last: Int
- ): CategoryCountableConnection
-
- """Background image of the category."""
- backgroundImage(
+ quantityAvailable(
"""
- Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended).
+ Destination address used to find warehouses where stock availability for this product is checked. If address is empty, uses `Shop.companyAddress` or fallbacks to server's `settings.DEFAULT_COUNTRY` configuration.
"""
- size: Int
+ address: AddressInput
"""
- The format of the image. When not provided, format of the original image will be used.
+ Two-letter ISO 3166-1 country code. When provided, the exact quantity from a warehouse operating in shipping zones that contain this country will be returned. Otherwise, it will return the maximum quantity from all shipping zones.
"""
- format: ThumbnailFormatEnum = ORIGINAL
- ): Image
-
- """Returns translated category fields for the given language code."""
- translation(
- """A language code to return the translation for category."""
- languageCode: LanguageCodeEnum!
- ): CategoryTranslation
-}
+ countryCode: CountryCode @deprecated(reason: "Use `address` argument instead.")
+ ): Int
-type CategoryCountableConnection @doc(category: "Products") {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [CategoryCountableEdge!]!
+ """Preorder data for product variant."""
+ preorder: PreorderData
- """A total count of items in the collection."""
- totalCount: Int
-}
+ """The date and time when the product variant was created."""
+ created: DateTime!
-type CategoryCountableEdge @doc(category: "Products") {
- """The item at the end of the edge."""
- node: Category!
+ """The date and time when the product variant was last updated."""
+ updatedAt: DateTime!
- """A cursor for use in pagination."""
- cursor: String!
+ """External ID of this product."""
+ externalReference: String
}
-input ProductFilterInput @doc(category: "Products") {
- isPublished: Boolean
- collections: [ID!]
- categories: [ID!]
- hasCategory: Boolean
- attributes: [AttributeInput!]
-
- """Filter by variants having specific stock status."""
- stockAvailability: StockAvailability
- stocks: ProductStockFilterInput
- search: String
- metadata: [MetadataFilter!]
+"""Represents product variant channel listing."""
+type ProductVariantChannelListing implements Node @doc(category: "Products") {
+ """The ID of the variant channel listing."""
+ id: ID!
- """Filter by the publication date."""
- publishedFrom: DateTime
+ """The channel to which the variant listing belongs."""
+ channel: Channel!
- """Filter by availability for purchase."""
- isAvailable: Boolean
+ """The price of the variant."""
+ price: Money
- """Filter by the date of availability for purchase."""
- availableFrom: DateTime
+ """Cost price of the variant."""
+ costPrice: Money
- """Filter by visibility in product listings."""
- isVisibleInListing: Boolean
- price: PriceRangeInput
+ """
+ Prior price of the variant used for discount calculations.
+
+ Added in Saleor 3.21.
+ """
+ priorPrice: Money
- """Filter by the lowest variant price after discounts."""
- minimalPrice: PriceRangeInput
+ """
+ Gross margin percentage value.
+
+ Requires one of the following permissions: MANAGE_PRODUCTS.
+ """
+ margin: Int
- """Filter by when was the most recent update."""
- updatedAt: DateTimeRangeInput
- productTypes: [ID!]
+ """Preorder variant data."""
+ preorderThreshold: PreorderThreshold
+}
- """Filter on whether product is a gift card or not."""
- giftCard: Boolean
- ids: [ID!]
- hasPreorderedVariants: Boolean
- slugs: [String!]
+"""Represents preorder variant data for channel."""
+type PreorderThreshold @doc(category: "Products") {
+ """Preorder threshold for product variant in this channel."""
+ quantity: Int
- """Specifies the channel by which the data should be filtered."""
- channel: String @deprecated(reason: "Use root-level channel argument instead.")
+ """Number of sold product variant in this channel."""
+ soldUnits: Int!
}
-input AttributeInput @doc(category: "Attributes") {
- """Internal representation of an attribute name."""
- slug: String
+"""Represents availability of a variant in the storefront."""
+type VariantPricingInfo @doc(category: "Products") {
+ """Whether it is in sale or not."""
+ onSale: Boolean
- """
- Filter by value of the attribute. Only one value input field is allowed. If provided more than one, the error will be raised. Cannot be combined with deprecated fields of `AttributeInput`.
- """
- value: AssignedAttributeValueInput
+ """The discount amount if in sale (null otherwise)."""
+ discount: TaxedMoney
"""
- Slugs identifying the attributeValues associated with the Attribute. When specified, it filters the results to include only records with one of the matching values. Requires `slug` to be provided.
+ The discount amount compared to prior price. Null if product is not on sale or prior price was not provided in VariantChannelListing
+
+ Added in Saleor 3.21.
"""
- values: [String!] @deprecated(reason: "Use `value` instead.")
+ discountPrior: TaxedMoney
- """
- The range that the returned values should be in. Requires `slug` to be provided.
- """
- valuesRange: IntRangeInput @deprecated(reason: "Use `value` instead.")
+ """The discount amount in the local currency."""
+ discountLocalCurrency: TaxedMoney @deprecated(reason: "Always returns `null`.")
+
+ """The price, with any discount subtracted."""
+ price: TaxedMoney
- """
- The date/time range that the returned values should be in. Requires `slug` to be provided.
- """
- dateTime: DateTimeRangeInput @deprecated(reason: "Use `value` instead.")
+ """The price without any discount."""
+ priceUndiscounted: TaxedMoney
"""
- The date range that the returned values should be in. In case of date/time attributes, the UTC midnight of the given date is used. Requires `slug` to be provided.
+ The price prior to discount.
+
+ Added in Saleor 3.21.
"""
- date: DateRangeInput @deprecated(reason: "Use `value` instead.")
+ pricePrior: TaxedMoney
- """The boolean value of the attribute. Requires `slug` to be provided."""
- boolean: Boolean @deprecated(reason: "Use `value` instead.")
+ """The discounted price in the local currency."""
+ priceLocalCurrency: TaxedMoney @deprecated(reason: "Always returns `null`.")
}
-input AssignedAttributeValueInput {
- """Filter by slug assigned to AttributeValue."""
- slug: StringFilterInput
-
- """Filter by name assigned to AttributeValue."""
- name: StringFilterInput
-
- """Filter by numeric value for attributes of numeric type."""
- numeric: DecimalFilterInput
-
- """Filter by date value for attributes of date type."""
- date: DateRangeInput
+"""
+Represents a monetary value with taxes. In cases where taxes were not applied, net and gross values will be equal.
+"""
+type TaxedMoney {
+ """Currency code."""
+ currency: String!
- """Filter by date time value for attributes of date time type."""
- dateTime: DateTimeRangeInput
+ """Amount of money including taxes."""
+ gross: Money!
- """Filter by boolean value for attributes of boolean type."""
- boolean: Boolean
+ """Amount of money without taxes."""
+ net: Money!
- """Filter by reference attribute value."""
- reference: AssignedAttributeReferenceInput
+ """Amount of taxes."""
+ tax: Money!
}
-"""Define the filtering options for decimal fields."""
-input DecimalFilterInput {
- """The value equal to."""
- eq: Decimal
-
- """The value included in."""
- oneOf: [Decimal!]
-
- """The value in range."""
- range: DecimalRangeInput
-}
+input AddressInput {
+ """Given name."""
+ firstName: String
-"""
-Custom Decimal implementation.
+ """Family name."""
+ lastName: String
-Returns Decimal as a float in the API,
-parses float to the Decimal on the way back.
-"""
-scalar Decimal
+ """Company or organization."""
+ companyName: String
-input DecimalRangeInput {
- """Decimal value greater than or equal to."""
- gte: Decimal
+ """Address."""
+ streetAddress1: String
- """Decimal value less than or equal to."""
- lte: Decimal
-}
+ """Address."""
+ streetAddress2: String
-input DateRangeInput {
- """Start date."""
- gte: Date
+ """City."""
+ city: String
- """End date."""
- lte: Date
-}
+ """District."""
+ cityArea: String
-input DateTimeRangeInput {
- """Start date."""
- gte: DateTime
+ """Postal code."""
+ postalCode: String
- """End date."""
- lte: DateTime
-}
+ """Country."""
+ country: CountryCode
-input AssignedAttributeReferenceInput {
- """
- Returns objects with a reference pointing to an object identified by the given ID.
- """
- referencedIds: ContainsFilterInput
+ """State or province."""
+ countryArea: String
"""
- Returns objects with a reference pointing to a page identified by the given slug.
+ Phone number.
+
+ Phone numbers are validated with Google's [libphonenumber](https://github.com/google/libphonenumber) library.
"""
- pageSlugs: ContainsFilterInput
+ phone: String
"""
- Returns objects with a reference pointing to a product identified by the given slug.
+ Address public metadata. Can be read by any API client authorized to read the object it's attached to.
+
+ Warning: never store sensitive information, including financial data such as credit card details.
"""
- productSlugs: ContainsFilterInput
+ metadata: [MetadataInput!]
"""
- Returns objects with a reference pointing to a product variant identified by the given sku.
+ Determine if the address should be validated. By default, Saleor accepts only address inputs matching ruleset from [Google Address Data]{https://chromium-i18n.appspot.com/ssl-address), using [i18naddress](https://github.com/mirumee/google-i18n-address) library. Some mutations may require additional permissions to use the the field. More info about permissions can be found in relevant mutation.
+
+ Added in Saleor 3.19.
+
+ Note: this API is currently in Feature Preview and can be subject to changes at later point.
"""
- productVariantSkus: ContainsFilterInput
-}
-
-"""
-Define the filtering options for fields that can contain multiple values.
-"""
-input ContainsFilterInput {
- """The field contains at least one of the specified values."""
- containsAny: [String!]
-
- """The field contains all of the specified values."""
- containsAll: [String!]
+ skipValidation: Boolean = false
}
-input IntRangeInput {
- """Value greater than or equal to."""
- gte: Int
+input MetadataInput {
+ """Key of a metadata item."""
+ key: String!
- """Value less than or equal to."""
- lte: Int
+ """Value of a metadata item."""
+ value: String!
}
-enum StockAvailability @doc(category: "Products") {
- IN_STOCK
- OUT_OF_STOCK
-}
+"""Represents a custom attribute."""
+type SelectedAttribute @doc(category: "Attributes") {
+ """Name of an attribute displayed in the interface."""
+ attribute: Attribute!
-input ProductStockFilterInput @doc(category: "Products") {
- warehouseIds: [ID!]
- quantity: IntRangeInput
+ """Values of an attribute."""
+ values: [AttributeValue!]!
}
-input PriceRangeInput {
- """Price greater than or equal to."""
- gte: Float
-
- """Price less than or equal to."""
- lte: Float
+enum ReportingPeriod {
+ TODAY
+ THIS_MONTH
}
-input ProductWhereInput @doc(category: "Products") {
- metadata: [MetadataFilter!]
- ids: [ID!]
-
- """Filter by product name."""
- name: StringFilterInput
-
- """Filter by product slug."""
- slug: StringFilterInput
-
- """Filter by product type."""
- productType: GlobalIDFilterInput
+"""Represents a product image."""
+type ProductImage @doc(category: "Products") {
+ """The ID of the image."""
+ id: ID!
- """Filter by product category."""
- category: GlobalIDFilterInput
+ """The alt text of the image."""
+ alt: String
- """Filter by collection."""
- collection: GlobalIDFilterInput
+ """
+ The new relative sorting position of the item (from -inf to +inf). 1 moves the item one position forward, -1 moves the item one position backward, 0 leaves the item unchanged.
+ """
+ sortOrder: Int
- """Filter by availability for purchase."""
- isAvailable: Boolean
+ """The URL of the image."""
+ url(
+ """
+ Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended).
+ """
+ size: Int
- """Filter by public visibility."""
- isPublished: Boolean
+ """
+ The format of the image. When not provided, format of the original image will be used.
+ """
+ format: ThumbnailFormatEnum = ORIGINAL
+ ): String!
+}
- """Filter by visibility on the channel."""
- isVisibleInListing: Boolean
+"""Represents a product media."""
+type ProductMedia implements Node & ObjectWithMetadata @doc(category: "Products") {
+ """The unique ID of the product media."""
+ id: ID!
- """Filter by the publication date."""
- publishedFrom: DateTime
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
- """Filter by the date of availability for purchase."""
- availableFrom: DateTime
+ """
+ A single key from private metadata. Requires staff permissions to access.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ privateMetafield(key: String!): String
- """Filter by product with category assigned."""
- hasCategory: Boolean
+ """
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ privateMetafields(keys: [String!]): Metadata
- """Filter by product variant price."""
- price: DecimalFilterInput
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
- """Filter by the lowest variant price after discounts."""
- minimalPrice: DecimalFilterInput
+ """
+ A single key from public metadata.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ metafield(key: String!): String
- """Filter by attributes associated with the product."""
- attributes: [AttributeInput!]
+ """
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ metafields(keys: [String!]): Metadata
- """Filter by variants having specific stock status."""
- stockAvailability: StockAvailability
+ """The sort order of the media."""
+ sortOrder: Int
- """Filter by stock of the product variant."""
- stocks: ProductStockFilterInput
+ """The alt text of the media."""
+ alt: String!
- """Filter on whether product is a gift card or not."""
- giftCard: Boolean
+ """The type of the media."""
+ type: ProductMediaType!
- """Filter by product with preordered variants."""
- hasPreorderedVariants: Boolean
+ """The oEmbed data of the media."""
+ oembedData: JSONString!
- """Filter by when was the most recent update."""
- updatedAt: DateTimeFilterInput
+ """The URL of the media."""
+ url(
+ """
+ Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended).
+ """
+ size: Int
- """List of conditions that must be met."""
- AND: [ProductWhereInput!]
+ """
+ The format of the image. When not provided, format of the original image will be used.
+ """
+ format: ThumbnailFormatEnum = ORIGINAL
+ ): String!
- """A list of conditions of which at least one must be met."""
- OR: [ProductWhereInput!]
+ """Product id the media refers to."""
+ productId: ID
}
-"""Define the filtering options for foreign key fields."""
-input GlobalIDFilterInput {
- """The value equal to."""
- eq: ID
-
- """The value included in."""
- oneOf: [ID!]
+enum ProductMediaType @doc(category: "Products") {
+ IMAGE
+ VIDEO
}
-"""Define the filtering options for date time fields."""
-input DateTimeFilterInput {
- """The value equal to."""
- eq: DateTime
+"""Represents product variant translations."""
+type ProductVariantTranslation implements Node @doc(category: "Products") {
+ """The ID of the product variant translation."""
+ id: ID!
- """The value included in."""
- oneOf: [DateTime!]
+ """Translation language."""
+ language: LanguageDisplay!
- """The value in range."""
- range: DateTimeRangeInput
+ """Translated product variant name."""
+ name: String!
+
+ """Represents the product variant fields to translate."""
+ translatableContent: ProductVariantTranslatableContent
}
-input ProductOrder @doc(category: "Products") {
- """Specifies the direction in which to sort products."""
- direction: OrderDirection!
+"""
+Represents product variant's original translatable fields and related translations.
+"""
+type ProductVariantTranslatableContent implements Node @doc(category: "Products") {
+ """The ID of the product variant translatable content."""
+ id: ID!
- """Specifies the channel in which to sort the data."""
- channel: String @deprecated(reason: "Use root-level channel argument instead.")
+ """The ID of the product variant to translate."""
+ productVariantId: ID!
- """
- Sort product by the selected attribute's values.
- Note: this doesn't take translations into account yet.
- """
- attributeId: ID
+ """Name of the product variant to translate."""
+ name: String!
- """Sort products by the selected field."""
- field: ProductOrderField
+ """Returns translated product variant fields for the given language code."""
+ translation(
+ """A language code to return the translation for product variant."""
+ languageCode: LanguageCodeEnum!
+ ): ProductVariantTranslation
+
+ """Represents a version of a product such as different size or color."""
+ productVariant: ProductVariant @deprecated(reason: "Get model fields from the root level queries.")
+
+ """List of product variant attribute values that can be translated."""
+ attributeValues: [AttributeValueTranslatableContent!]!
}
-enum ProductOrderField @doc(category: "Products") {
- """Sort products by name."""
- NAME
+"""Represents digital content associated with a product variant."""
+type DigitalContent implements Node & ObjectWithMetadata @doc(category: "Products") {
+ """The ID of the digital content."""
+ id: ID!
- """
- Sort products by rank. Note: This option is available only with the `search` filter.
- """
- RANK
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
"""
- Sort products by price.
+ A single key from private metadata. Requires staff permissions to access.
- This option requires a channel filter to work as the values can vary between channels.
+ Tip: Use GraphQL aliases to fetch multiple keys.
"""
- PRICE
+ privateMetafield(key: String!): String
"""
- Sort products by a minimal price of a product's variant.
-
- This option requires a channel filter to work as the values can vary between channels.
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
"""
- MINIMAL_PRICE
-
- """Sort products by update date."""
- LAST_MODIFIED @deprecated(reason: "Use `LAST_MODIFIED_AT` instead.")
-
- """Sort products by update date."""
- DATE @deprecated(reason: "Use `LAST_MODIFIED_AT` instead.")
+ privateMetafields(keys: [String!]): Metadata
- """Sort products by type."""
- TYPE
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
"""
- Sort products by publication status.
+ A single key from public metadata.
- This option requires a channel filter to work as the values can vary between channels.
+ Tip: Use GraphQL aliases to fetch multiple keys.
"""
- PUBLISHED
+ metafield(key: String!): String
"""
- Sort products by publication date.
-
- This option requires a channel filter to work as the values can vary between channels.
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
"""
- PUBLICATION_DATE @deprecated(reason: "Use `PUBLISHED_AT` instead.")
+ metafields(keys: [String!]): Metadata
- """
- Sort products by publication date.
-
- This option requires a channel filter to work as the values can vary between channels.
- """
- PUBLISHED_AT
+ """Default settings indicator for digital content."""
+ useDefaultSettings: Boolean!
- """Sort products by update date."""
- LAST_MODIFIED_AT
+ """Indicator for automatic fulfillment of digital content."""
+ automaticFulfillment: Boolean!
- """
- Sort products by collection. Note: This option is available only for the `Collection.products` query.
-
- This option requires a channel filter to work as the values can vary between channels.
- """
- COLLECTION
+ """File associated with digital content."""
+ contentFile: String!
- """Sort products by rating."""
- RATING
+ """Maximum number of allowed downloads for the digital content."""
+ maxDownloads: Int
- """Sort products by creation date."""
- CREATED_AT
-}
+ """Number of days the URL for the digital content remains valid."""
+ urlValidDays: Int
-"""Represents an image."""
-type Image {
- """The URL of the image."""
- url: String!
+ """List of URLs for the digital variant."""
+ urls: [DigitalContentUrl!]
- """Alt text for an image."""
- alt: String
+ """Product variant assigned to digital content."""
+ productVariant: ProductVariant!
}
-"""Represents category translations."""
-type CategoryTranslation implements Node @doc(category: "Products") {
- """The ID of the category translation."""
+"""Represents a URL for digital content."""
+type DigitalContentUrl implements Node @doc(category: "Products") {
+ """The ID of the digital content URL."""
id: ID!
- """Translation language."""
- language: LanguageDisplay!
+ """Digital content associated with the URL."""
+ content: DigitalContent!
- """Translated SEO title."""
- seoTitle: String
+ """Date and time when the digital content URL was created."""
+ created: DateTime!
- """Translated SEO description."""
- seoDescription: String
+ """Number of times digital content has been downloaded."""
+ downloadNum: Int!
- """
- Translated category slug.
-
- Added in Saleor 3.21.
- """
- slug: String
+ """URL for digital content."""
+ url: String
- """Translated category name."""
- name: String
+ """UUID of digital content."""
+ token: UUID!
+}
+
+scalar UUID
+
+"""Represents stock."""
+type Stock implements Node @doc(category: "Products") {
+ """The ID of stock."""
+ id: ID!
+
+ """The warehouse associated with the stock."""
+ warehouse: Warehouse!
+
+ """Information about the product variant."""
+ productVariant: ProductVariant!
"""
- Translated description of the category.
+ Quantity of a product in the warehouse's possession, including the allocated stock that is waiting for shipment.
- Rich text format. For reference see https://editorjs.io/
+ Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
"""
- description: JSONString
+ quantity: Int!
"""
- Translated description of the category.
+ Quantity allocated for orders.
- Rich text format. For reference see https://editorjs.io/
- """
- descriptionJson: JSONString @deprecated(reason: "Use the `description` field instead.")
-
- """Represents the category fields to translate."""
- translatableContent: CategoryTranslatableContent
-}
-
-"""
-Represents category original translatable fields and related translations.
-"""
-type CategoryTranslatableContent implements Node @doc(category: "Products") {
- """The ID of the category translatable content."""
- id: ID!
-
- """The ID of the category to translate."""
- categoryId: ID!
-
- """SEO title to translate."""
- seoTitle: String
-
- """SEO description to translate."""
- seoDescription: String
+ Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
+ """
+ quantityAllocated: Int!
"""
- Slug to translate.
+ Quantity reserved for checkouts.
- Added in Saleor 3.21.
+ Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
"""
- slug: String
-
- """Name of the category translatable content."""
- name: String!
+ quantityReserved: Int!
+}
+"""Represents preorder settings for product variant."""
+type PreorderData @doc(category: "Products") {
"""
- Category description to translate.
+ The global preorder threshold for product variant.
- Rich text format. For reference see https://editorjs.io/
+ Requires one of the following permissions: MANAGE_PRODUCTS.
"""
- description: JSONString
+ globalThreshold: Int
"""
- Description of the category.
+ Total number of sold product variant during preorder.
- Rich text format. For reference see https://editorjs.io/
+ Requires one of the following permissions: MANAGE_PRODUCTS.
"""
- descriptionJson: JSONString @deprecated(reason: "Use the `description` field instead.")
-
- """Returns translated category fields for the given language code."""
- translation(
- """A language code to return the translation for category."""
- languageCode: LanguageCodeEnum!
- ): CategoryTranslation
+ globalSoldUnits: Int!
- """Represents a single category of products."""
- category: Category @deprecated(reason: "Get model fields from the root level queries.")
+ """Preorder end date."""
+ endDate: DateTime
}
"""Represents availability of a product in the storefront."""
@@ -8629,16 +8345,242 @@ type CollectionChannelListing implements Node @doc(category: "Products") {
"""The collection publication date."""
publishedAt: DateTime
- """Indicates if the collection is published in the channel."""
- isPublished: Boolean!
+ """Indicates if the collection is published in the channel."""
+ isPublished: Boolean!
+
+ """The channel to which the collection belongs."""
+ channel: Channel!
+}
+
+"""Represents product translations."""
+type ProductTranslation implements Node @doc(category: "Products") {
+ """The ID of the product translation."""
+ id: ID!
+
+ """Translation language."""
+ language: LanguageDisplay!
+
+ """Translated SEO title."""
+ seoTitle: String
+
+ """Translated SEO description."""
+ seoDescription: String
+
+ """
+ Translated product slug.
+
+ Added in Saleor 3.21.
+ """
+ slug: String
+
+ """Translated product name."""
+ name: String
+
+ """
+ Translated description of the product.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ description: JSONString
+
+ """
+ Translated description of the product.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ descriptionJson: JSONString @deprecated(reason: "Use the `description` field instead.")
+
+ """Represents the product fields to translate."""
+ translatableContent: ProductTranslatableContent
+}
+
+"""
+Represents product's original translatable fields and related translations.
+"""
+type ProductTranslatableContent implements Node @doc(category: "Products") {
+ """The ID of the product translatable content."""
+ id: ID!
+
+ """The ID of the product to translate."""
+ productId: ID!
+
+ """SEO title to translate."""
+ seoTitle: String
+
+ """SEO description to translate."""
+ seoDescription: String
+
+ """
+ Slug to translate.
+
+ Added in Saleor 3.21.
+ """
+ slug: String
+
+ """Product's name to translate."""
+ name: String!
+
+ """
+ Product's description to translate.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ description: JSONString
+
+ """
+ Description of the product.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ descriptionJson: JSONString @deprecated(reason: "Use the `description` field instead.")
+
+ """Returns translated product fields for the given language code."""
+ translation(
+ """A language code to return the translation for product."""
+ languageCode: LanguageCodeEnum!
+ ): ProductTranslation
+
+ """Represents an individual item for sale in the storefront."""
+ product: Product @deprecated(reason: "Get model fields from the root level queries.")
+
+ """List of product attribute values that can be translated."""
+ attributeValues: [AttributeValueTranslatableContent!]!
+}
+
+type StockCountableConnection @doc(category: "Products") {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [StockCountableEdge!]!
+
+ """A total count of items in the collection."""
+ totalCount: Int
+}
+
+type StockCountableEdge @doc(category: "Products") {
+ """The item at the end of the edge."""
+ node: Stock!
+
+ """A cursor for use in pagination."""
+ cursor: String!
+}
+
+type WarehouseCountableConnection @doc(category: "Products") {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [WarehouseCountableEdge!]!
+
+ """A total count of items in the collection."""
+ totalCount: Int
+}
+
+type WarehouseCountableEdge @doc(category: "Products") {
+ """The item at the end of the edge."""
+ node: Warehouse!
+
+ """A cursor for use in pagination."""
+ cursor: String!
+}
+
+input WarehouseFilterInput @doc(category: "Products") {
+ clickAndCollectOption: WarehouseClickAndCollectOptionEnum
+ metadata: [MetadataFilter!]
+ search: String
+ ids: [ID!]
+ isPrivate: Boolean
+ channels: [ID!]
+ slugs: [String!]
+}
+
+input WarehouseSortingInput @doc(category: "Products") {
+ """Specifies the direction in which to sort warehouses."""
+ direction: OrderDirection!
+
+ """Sort warehouses by the selected field."""
+ field: WarehouseSortField!
+}
+
+enum WarehouseSortField @doc(category: "Products") {
+ """Sort warehouses by name."""
+ NAME
+}
+
+type TranslatableItemConnection {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [TranslatableItemEdge!]!
+
+ """A total count of items in the collection."""
+ totalCount: Int
+}
+
+type TranslatableItemEdge {
+ """The item at the end of the edge."""
+ node: TranslatableItem!
+
+ """A cursor for use in pagination."""
+ cursor: String!
+}
+
+union TranslatableItem = ProductTranslatableContent | CollectionTranslatableContent | CategoryTranslatableContent | AttributeTranslatableContent | AttributeValueTranslatableContent | ProductVariantTranslatableContent | PageTranslatableContent | ShippingMethodTranslatableContent | VoucherTranslatableContent | MenuItemTranslatableContent | PromotionTranslatableContent | PromotionRuleTranslatableContent | SaleTranslatableContent
+
+"""
+Represents page's original translatable fields and related translations.
+"""
+type PageTranslatableContent implements Node @doc(category: "Pages") {
+ """The ID of the page translatable content."""
+ id: ID!
+
+ """The ID of the page to translate."""
+ pageId: ID!
+
+ """SEO title to translate."""
+ seoTitle: String
+
+ """SEO description to translate."""
+ seoDescription: String
+
+ """
+ Slug to translate.
+
+ Added in Saleor 3.21.
+ """
+ slug: String
+
+ """Page title to translate."""
+ title: String!
+
+ """
+ Content of the page to translate.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ content: JSONString
+
+ """
+ Content of the page.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ contentJson: JSONString @deprecated(reason: "Use the `content` field instead.")
+
+ """Returns translated page fields for the given language code."""
+ translation(
+ """A language code to return the translation for page."""
+ languageCode: LanguageCodeEnum!
+ ): PageTranslation
+
+ """
+ A static page that can be manually added by a shop operator through the dashboard.
+ """
+ page: Page @deprecated(reason: "Get model fields from the root level queries.")
- """The channel to which the collection belongs."""
- channel: Channel!
+ """List of page content attribute values that can be translated."""
+ attributeValues: [AttributeValueTranslatableContent!]!
}
-"""Represents product translations."""
-type ProductTranslation implements Node @doc(category: "Products") {
- """The ID of the product translation."""
+"""Represents page translations."""
+type PageTranslation implements Node @doc(category: "Pages") {
+ """The ID of the page translation."""
id: ID!
"""Translation language."""
@@ -8651,161 +8593,210 @@ type ProductTranslation implements Node @doc(category: "Products") {
seoDescription: String
"""
- Translated product slug.
+ Translated page slug.
Added in Saleor 3.21.
"""
slug: String
- """Translated product name."""
- name: String
+ """Translated page title."""
+ title: String
"""
- Translated description of the product.
+ Translated content of the page.
Rich text format. For reference see https://editorjs.io/
"""
- description: JSONString
+ content: JSONString
"""
- Translated description of the product.
+ Translated description of the page.
Rich text format. For reference see https://editorjs.io/
"""
- descriptionJson: JSONString @deprecated(reason: "Use the `description` field instead.")
+ contentJson: JSONString @deprecated(reason: "Use the `content` field instead.")
- """Represents the product fields to translate."""
- translatableContent: ProductTranslatableContent
+ """Represents the page fields to translate."""
+ translatableContent: PageTranslatableContent
}
"""
-Represents product's original translatable fields and related translations.
+A static page that can be manually added by a shop operator through the dashboard.
"""
-type ProductTranslatableContent implements Node @doc(category: "Products") {
- """The ID of the product translatable content."""
+type Page implements Node & ObjectWithMetadata @doc(category: "Pages") {
+ """ID of the page."""
id: ID!
- """The ID of the product to translate."""
- productId: ID!
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
- """SEO title to translate."""
- seoTitle: String
+ """
+ A single key from private metadata. Requires staff permissions to access.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ privateMetafield(key: String!): String
- """SEO description to translate."""
- seoDescription: String
+ """
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ privateMetafields(keys: [String!]): Metadata
+
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
"""
- Slug to translate.
+ A single key from public metadata.
- Added in Saleor 3.21.
+ Tip: Use GraphQL aliases to fetch multiple keys.
"""
- slug: String
+ metafield(key: String!): String
- """Product's name to translate."""
- name: String!
+ """
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ metafields(keys: [String!]): Metadata
+
+ """Title of the page for SEO."""
+ seoTitle: String
+
+ """Description of the page for SEO."""
+ seoDescription: String
+
+ """Title of the page."""
+ title: String!
"""
- Product's description to translate.
+ Content of the page.
Rich text format. For reference see https://editorjs.io/
"""
- description: JSONString
+ content: JSONString
+ publicationDate: Date @deprecated(reason: "Use the `publishedAt` field to fetch the publication date.")
+
+ """The page publication date."""
+ publishedAt: DateTime
+
+ """Determines if the page is published."""
+ isPublished: Boolean!
+
+ """Slug of the page."""
+ slug: String!
+
+ """Determines the type of page"""
+ pageType: PageType!
+
+ """Date and time at which page was created."""
+ created: DateTime!
"""
- Description of the product.
+ Content of the page.
Rich text format. For reference see https://editorjs.io/
"""
- descriptionJson: JSONString @deprecated(reason: "Use the `description` field instead.")
+ contentJson: JSONString! @deprecated(reason: "Use the `content` field instead.")
- """Returns translated product fields for the given language code."""
+ """Returns translated page fields for the given language code."""
translation(
- """A language code to return the translation for product."""
+ """A language code to return the translation for page."""
languageCode: LanguageCodeEnum!
- ): ProductTranslation
+ ): PageTranslation
- """Represents an individual item for sale in the storefront."""
- product: Product @deprecated(reason: "Get model fields from the root level queries.")
+ """Get a single attribute attached to page by attribute slug."""
+ attribute(
+ """Slug of the attribute"""
+ slug: String!
+ ): SelectedAttribute
- """List of product attribute values that can be translated."""
- attributeValues: [AttributeValueTranslatableContent!]!
+ """List of attributes assigned to this page."""
+ attributes: [SelectedAttribute!]!
}
-type StockCountableConnection @doc(category: "Products") {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [StockCountableEdge!]!
+"""
+Represents a type of page. It defines what attributes are available to pages of this type.
+"""
+type PageType implements Node & ObjectWithMetadata @doc(category: "Pages") {
+ """ID of the page type."""
+ id: ID!
- """A total count of items in the collection."""
- totalCount: Int
-}
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
-type StockCountableEdge @doc(category: "Products") {
- """The item at the end of the edge."""
- node: Stock!
+ """
+ A single key from private metadata. Requires staff permissions to access.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ privateMetafield(key: String!): String
- """A cursor for use in pagination."""
- cursor: String!
-}
+ """
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ privateMetafields(keys: [String!]): Metadata
-type WarehouseCountableConnection @doc(category: "Products") {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [WarehouseCountableEdge!]!
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
- """A total count of items in the collection."""
- totalCount: Int
-}
+ """
+ A single key from public metadata.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ metafield(key: String!): String
-type WarehouseCountableEdge @doc(category: "Products") {
- """The item at the end of the edge."""
- node: Warehouse!
+ """
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ metafields(keys: [String!]): Metadata
- """A cursor for use in pagination."""
- cursor: String!
-}
+ """Name of the page type."""
+ name: String!
-input WarehouseFilterInput @doc(category: "Products") {
- clickAndCollectOption: WarehouseClickAndCollectOptionEnum
- metadata: [MetadataFilter!]
- search: String
- ids: [ID!]
- isPrivate: Boolean
- channels: [ID!]
- slugs: [String!]
-}
+ """Slug of the page type."""
+ slug: String!
-input WarehouseSortingInput @doc(category: "Products") {
- """Specifies the direction in which to sort warehouses."""
- direction: OrderDirection!
+ """Page attributes of that page type."""
+ attributes: [Attribute!]
- """Sort warehouses by the selected field."""
- field: WarehouseSortField!
-}
+ """
+ Attributes that can be assigned to the page type.
+
+ Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES.
+ """
+ availableAttributes(
+ """Filtering options for attributes."""
+ filter: AttributeFilterInput @deprecated(reason: "Use `where` filter instead.")
-enum WarehouseSortField @doc(category: "Products") {
- """Sort warehouses by name."""
- NAME
-}
+ """Where filtering options for attributes."""
+ where: AttributeWhereInput
-type TranslatableItemConnection {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [TranslatableItemEdge!]!
+ """Search attributes."""
+ search: String
- """A total count of items in the collection."""
- totalCount: Int
-}
+ """Return the elements in the list that come before the specified cursor."""
+ before: String
-type TranslatableItemEdge {
- """The item at the end of the edge."""
- node: TranslatableItem!
+ """Return the elements in the list that come after the specified cursor."""
+ after: String
- """A cursor for use in pagination."""
- cursor: String!
-}
+ """
+ Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ first: Int
-union TranslatableItem = ProductTranslatableContent | CollectionTranslatableContent | CategoryTranslatableContent | AttributeTranslatableContent | AttributeValueTranslatableContent | ProductVariantTranslatableContent | PageTranslatableContent | ShippingMethodTranslatableContent | VoucherTranslatableContent | MenuItemTranslatableContent | PromotionTranslatableContent | PromotionRuleTranslatableContent | SaleTranslatableContent
+ """
+ Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ last: Int
+ ): AttributeCountableConnection
+
+ """
+ Whether page type has pages assigned.
+
+ Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES.
+ """
+ hasPages: Boolean
+}
"""
Represents voucher's original translatable fields and related translations.