Skip to content

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

Remove deprecated thumbnailUrl, taxRate, availableOn from Product

fowczarekf8458f873368
diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.py
index 20fdd30b07..34cd350d80 100644
--- a/saleor/graphql/product/types/products.py
+++ b/saleor/graphql/product/types/products.py
@@ -375,14 +375,6 @@ class Product(CountableDjangoObjectType, MetadataObjectType):
url = graphene.String(
description="The storefront URL for the product.", required=True
)
- thumbnail_url = graphene.String(
- description="The URL of a main thumbnail for a product.",
- size=graphene.Argument(graphene.Int, description="Size of thumbnail"),
- deprecation_reason=(
- """thumbnailUrl is deprecated, use
- thumbnail instead"""
- ),
- )
thumbnail = graphene.Field(
Image,
description="The main thumbnail for a product.",
@@ -411,13 +403,6 @@ class Product(CountableDjangoObjectType, MetadataObjectType):
minimal_variant_price = graphene.Field(
Money, description="The price of the cheapest variant (including discounts)."
)
- tax_rate = TaxRateType(
- description="A type of tax rate.",
- deprecation_reason=(
- "taxRate is deprecated. Use taxType to obtain taxCode for given tax gateway"
- ),
- )
-
tax_type = graphene.Field(
TaxType, description="A type of tax. Assigned by enabled tax gateway"
)
@@ -449,9 +434,6 @@ class Product(CountableDjangoObjectType, MetadataObjectType):
),
model_field="collections",
)
- available_on = graphene.Date(
- deprecation_reason=("availableOn is deprecated, use publicationDate instead")
- )
translation = graphene.Field(
ProductTranslation,
language_code=graphene.Argument(
@@ -486,29 +468,11 @@ class Product(CountableDjangoObjectType, MetadataObjectType):
"weight",
]
- @staticmethod
- def resolve_tax_rate(root: models.Product, _info, **_kwargs):
- # FIXME this resolver should be dropped after we drop tax_rate from API
- if not hasattr(root, "meta"):
- return None
- tax = root.meta.get("taxes", {}).get("vatlayer", {})
- return tax.get("code")
-
@staticmethod
def resolve_tax_type(root: models.Product, info):
tax_data = info.context.extensions.get_tax_code_from_object_meta(root)
return TaxType(tax_code=tax_data.code, description=tax_data.description)
- @staticmethod
- @gql_optimizer.resolver_hints(prefetch_related="images")
- def resolve_thumbnail_url(root: models.Product, info, *, size=None):
- if not size:
- size = 255
- url = get_product_image_thumbnail(
- root.get_first_image(), size, method="thumbnail"
- )
- return info.context.build_absolute_uri(url)
-
@staticmethod
@gql_optimizer.resolver_hints(prefetch_related="images")
def resolve_thumbnail(root: models.Product, info, *, size=None):
@@ -609,10 +573,6 @@ class Product(CountableDjangoObjectType, MetadataObjectType):
def resolve_collections(root: models.Product, *_args):
return root.collections.all()
- @staticmethod
- def resolve_available_on(root: models.Product, *_args):
- return root.publication_date
-
@classmethod
def get_node(cls, info, pk):
if info.context:
diff --git a/tests/api/test_graphql.py b/tests/api/test_graphql.py
index 6df7991ede..88a891a968 100644
--- a/tests/api/test_graphql.py
+++ b/tests/api/test_graphql.py
@@ -135,8 +135,12 @@ def test_real_query(user_api_client, product):
...ProductPriceFragmentQuery
__typename
}
- thumbnailUrl1x: thumbnailUrl(size: 255)
- thumbnailUrl2x: thumbnailUrl(size: 510)
+ thumbnailUrl1x: thumbnail(size: 255){
+ url
+ }
+ thumbnailUrl2x: thumbnail(size: 510){
+ url
+ }
url
__typename
}
diff --git a/tests/api/test_product.py b/tests/api/test_product.py
index 8b1a7f2c67..2ae09d843f 100644
--- a/tests/api/test_product.py
+++ b/tests/api/test_product.py
@@ -120,7 +120,6 @@ def test_product_query(staff_api_client, product, permission_manage_products):
name
url
slug
- thumbnailUrl
thumbnail{
url
alt