Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
drop tax_rate from Product and ProductType (#6795)
Damian Wysocki05efc538ceb7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 80e72e3a77..bbe86c40bf 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -13,6 +13,7 @@ All notable, unreleased changes to this project will be documented in this file.- Drop `type` field from `AttributeValue` type - #6710 by @IKarbowiak- Drop `apply_taxes_to_shipping_price_range` plugin hook - #6746 by @maarcingebala- Drop `CHECKOUT_QUANTITY_CHANGED` webhook - #6797 by @d-wysocki+- Drop deprecated `taxRate` field from `ProductType` - #6795 by @d-wysocki### Otherdiff --git a/saleor/graphql/product/mutations/products.py b/saleor/graphql/product/mutations/products.pyindex d20836232d..2e5547c7b4 100644--- a/saleor/graphql/product/mutations/products.py+++ b/saleor/graphql/product/mutations/products.py@@ -569,11 +569,6 @@ class ProductCreate(ModelMutation):error.code = ProductErrorCode.REQUIRED.valueraise ValidationError({"slug": error})- # FIXME tax_rate logic should be dropped after we remove tax_rate from input- tax_rate = cleaned_input.pop("tax_rate", "")- if tax_rate:- info.context.plugins.assign_tax_code_to_object_meta(instance, tax_rate)-if "tax_code" in cleaned_input:info.context.plugins.assign_tax_code_to_object_meta(instance, cleaned_input["tax_code"]@@ -1070,14 +1065,6 @@ class ProductTypeCreate(ModelMutation):error.code = ProductErrorCode.REQUIRED.valueraise ValidationError({"slug": error})- # FIXME tax_rate logic should be dropped after we remove tax_rate from input- tax_rate = cleaned_input.pop("tax_rate", "")- if tax_rate:- instance.store_value_in_metadata(- {"vatlayer.code": tax_rate, "description": tax_rate}- )- info.context.plugins.assign_tax_code_to_object_meta(instance, tax_rate)-tax_code = cleaned_input.pop("tax_code", "")if tax_code:info.context.plugins.assign_tax_code_to_object_meta(instance, tax_code)diff --git a/saleor/graphql/product/tests/test_product.py b/saleor/graphql/product/tests/test_product.pyindex a1774f8aed..d876c423fb 100644--- a/saleor/graphql/product/tests/test_product.py+++ b/saleor/graphql/product/tests/test_product.py@@ -5020,7 +5020,6 @@ PRODUCT_TYPE_QUERY = """}}}- taxRatetaxType {taxCodedescription@@ -5180,7 +5179,6 @@ PRODUCT_TYPE_CREATE_MUTATION = """productType {nameslug- taxRateisShippingRequiredhasVariantsvariantAttributes {diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.pyindex 99edb98c0e..bb97b6869c 100644--- a/saleor/graphql/product/types/products.py+++ b/saleor/graphql/product/types/products.py@@ -32,7 +32,7 @@ from ...channel.dataloaders import ChannelBySlugLoaderfrom ...channel.types import ChannelContextType, ChannelContextTypeWithMetadatafrom ...channel.utils import get_default_channel_slug_or_graphql_errorfrom ...core.connection import CountableDjangoObjectType-from ...core.enums import ReportingPeriod, TaxRateType+from ...core.enums import ReportingPeriodfrom ...core.fields import (ChannelContextFilterConnectionField,FilterInputConnectionField,@@ -790,7 +790,6 @@ class ProductType(CountableDjangoObjectType):"Use the top-level `products` query with the `productTypes` filter."),)- tax_rate = TaxRateType(description="A type of tax rate.")tax_type = graphene.Field(TaxType, description="A type of tax. Assigned by enabled tax gateway")@@ -832,13 +831,6 @@ class ProductType(CountableDjangoObjectType):tax_data = info.context.plugins.get_tax_code_from_object_meta(root)return TaxType(tax_code=tax_data.code, description=tax_data.description)- @staticmethod- def resolve_tax_rate(root: models.ProductType, _info, **_kwargs):- # FIXME this resolver should be dropped after we drop tax_rate from API- if not hasattr(root, "meta"):- return None- return root.get_value_from_metadata("vatlayer.code")-@staticmethoddef resolve_product_attributes(root: models.ProductType, info):return ProductAttributesByProductTypeIdLoader(info.context).load(root.pk)diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex ab38e932bf..51d57353fc 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -4129,7 +4129,6 @@ type ProductType implements Node & ObjectWithMetadata {privateMetadata: [MetadataItem]!metadata: [MetadataItem]!products(channel: String, before: String, after: String, first: Int, last: Int): ProductCountableConnection @deprecated(reason: "Use the top-level `products` query with the `productTypes` filter.")- taxRate: TaxRateTypetaxType: TaxTypevariantAttributes(variantSelection: VariantAttributeScope): [Attribute]productAttributes: [Attribute]