Skip to content

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

Deprecate attribute(s) fields for Product and ProductVariant type (#18168)

Maciej Korycinski42564924f96b
diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.py
index 85c191efbd..4fab5e9ba7 100644
--- a/saleor/graphql/product/types/products.py
+++ b/saleor/graphql/product/types/products.py
@@ -371,6 +371,7 @@ class ProductVariant(ChannelContextType[models.ProductVariant]):
VariantAttributeScope,
description="Define scope of returned attributes.",
),
+ deprecation_reason="Use the `assignedAttributes` field instead.",
)
margin = graphene.Int(description="Gross margin percentage value.")
quantity_ordered = PermissionsField(
@@ -1077,11 +1078,13 @@ class Product(ChannelContextType[models.Product]):
required=True,
),
description="Get a single attribute attached to product by attribute slug.",
+ deprecation_reason="Use the `assignedAttribute` field instead.",
)
attributes = NonNullList(
SelectedAttribute,
required=True,
description="List of attributes assigned to this product.",
+ deprecation_reason="Use the `assignedAttributes` field instead.",
)
channel_listings = PermissionsField(
NonNullList(ProductChannelListing),
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 189e5edd8e..03732a0d59 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -5750,10 +5750,10 @@ type Product implements Node & ObjectWithMetadata & ObjectWithAttributes @doc(ca
attribute(
"""Slug of the attribute"""
slug: String!
- ): SelectedAttribute
+ ): SelectedAttribute @deprecated(reason: "Use the `assignedAttribute` field instead.")
"""List of attributes assigned to this product."""
- attributes: [SelectedAttribute!]!
+ attributes: [SelectedAttribute!]! @deprecated(reason: "Use the `assignedAttributes` field instead.")
"""
List of availability in channels for the product.
@@ -7500,7 +7500,7 @@ type ProductVariant implements Node & ObjectWithMetadata & ObjectWithAttributes
attributes(
"""Define scope of returned attributes."""
variantSelection: VariantAttributeScope
- ): [SelectedAttribute!]!
+ ): [SelectedAttribute!]! @deprecated(reason: "Use the `assignedAttributes` field instead.")
"""Gross margin percentage value."""
margin: Int