Skip to content

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

Remove price and availability from Product and ProductVariant

IKarbowiak350a7a536b9c
diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.py
index dd394be8ab..1733a2667f 100644
--- a/saleor/graphql/product/types/products.py
+++ b/saleor/graphql/product/types/products.py
@@ -202,24 +202,6 @@ class ProductVariant(CountableDjangoObjectType, MetadataObjectType):
"indicates that the default product price is used."
),
)
- price = graphene.Field(
- Money,
- description="Price of the product variant.",
- deprecation_reason=(
- "DEPRECATED: Will be removed in Saleor 2.10, "
- "has been replaced by 'pricing.priceUndiscounted'"
- ),
- )
- availability = graphene.Field(
- VariantPricingInfo,
- description=(
- "Informs about variant's availability in the storefront, current price and "
- "discounted price."
- ),
- deprecation_reason=(
- "DEPRECATED: Will be removed in Saleor 2.10, has been renamed to `pricing`."
- ),
- )
pricing = graphene.Field(
VariantPricingInfo,
description=(
@@ -404,16 +386,6 @@ class Product(CountableDjangoObjectType, MetadataObjectType):
description="The main thumbnail for a product.",
size=graphene.Argument(graphene.Int, description="Size of thumbnail."),
)
- availability = graphene.Field(
- ProductPricingInfo,
- description=(
- "Informs about product's availability in the storefront, current price and "
- "discounts."
- ),
- deprecation_reason=(
- "DEPRECATED: Will be removed in Saleor 2.10, Has been renamed to `pricing`."
- ),
- )
pricing = graphene.Field(
ProductPricingInfo,
description=(
@@ -425,14 +397,6 @@ class Product(CountableDjangoObjectType, MetadataObjectType):
description="Whether the product is in stock and visible or not."
)
base_price = graphene.Field(Money, description="The product's default base price.")
- price = graphene.Field(
- Money,
- description="The product's default base price.",
- deprecation_reason=(
- "DEPRECATED: Will be removed in Saleor 2.10, has been replaced by "
- "`basePrice`"
- ),
- )
minimal_variant_price = graphene.Field(
Money, description="The price of the cheapest variant (including discounts)."
)
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 2ca3c5ee5f..9c725e4d93 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -2955,11 +2955,9 @@ type Product implements Node {
meta: [MetaStore]!
url: String!
thumbnail(size: Int): Image
- availability: ProductPricingInfo @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, Has been renamed to `pricing`.")
pricing: ProductPricingInfo
isAvailable: Boolean
basePrice: Money
- price: Money @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, has been replaced by `basePrice`")
minimalVariantPrice: Money
taxType: TaxType
attributes: [SelectedAttribute!]!
@@ -3344,8 +3342,6 @@ type ProductVariant implements Node {
quantity: Int!
stockQuantity: Int!
priceOverride: Money
- price: Money @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, has been replaced by 'pricing.priceUndiscounted'")
- availability: VariantPricingInfo @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, has been renamed to `pricing`.")
pricing: VariantPricingInfo
isAvailable: Boolean
attributes: [SelectedAttribute!]!
diff --git a/tests/api/benchmark/test_checkout.py b/tests/api/benchmark/test_checkout.py
index 1ef2dfc5d8..7841e0f00e 100644
--- a/tests/api/benchmark/test_checkout.py
+++ b/tests/api/benchmark/test_checkout.py
@@ -74,10 +74,35 @@ def test_create_checkout(api_client, graphql_address_data, variant, count_querie
fragment ProductVariant on ProductVariant {
id
name
- price {
- amount
- currency
- localized
+ pricing {
+ discountLocalCurrency {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ price {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ priceUndiscounted {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ priceLocalCurrency {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
}
product {
id
@@ -213,10 +238,35 @@ def test_add_shipping_to_checkout(
fragment ProductVariant on ProductVariant {
id
name
- price {
- amount
- currency
- localized
+ pricing {
+ discountLocalCurrency {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ price {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ priceUndiscounted {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ priceLocalCurrency {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
}
product {
id
@@ -345,10 +395,35 @@ def test_add_billing_address_to_checkout(
fragment ProductVariant on ProductVariant {
id
name
- price {
- amount
- currency
- localized
+ pricing {
+ discountLocalCurrency {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ price {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ priceUndiscounted {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ priceLocalCurrency {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
}
product {
id
diff --git a/tests/api/benchmark/test_product.py b/tests/api/benchmark/test_product.py
index 3a77ba33c9..13bd2d6d98 100644
--- a/tests/api/benchmark/test_product.py
+++ b/tests/api/benchmark/test_product.py
@@ -26,10 +26,35 @@ def test_product_details(product, api_client, count_queries):
name
stockQuantity
isAvailable
- price {
- currency
- amount
- localized
+ pricing {
+ discountLocalCurrency {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ price {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ priceUndiscounted {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ priceLocalCurrency {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
}
attributes {
attribute {
@@ -59,20 +84,60 @@ def test_product_details(product, api_client, count_queries):
id
name
}
- price {
- amount
- currency
- localized
+ pricing {
+ priceRange {
+ start{
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ stop{
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ }
+ priceRangeUndiscounted {
+ start{
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ stop{
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ }
+ priceRangeLocalCurrency {
+ start{
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ stop{
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ }
}
}
}
}
}
- price {
- amount
- currency
- localized
- }
images {
id
url
diff --git a/tests/api/benchmark/test_variant.py b/tests/api/benchmark/test_variant.py
index 600cbf6c7f..8c5f83d6a3 100644
--- a/tests/api/benchmark/test_variant.py
+++ b/tests/api/benchmark/test_variant.py
@@ -29,10 +29,35 @@ def test_retrieve_variant_list(product_variant_list, api_client, count_queries):
name
stockQuantity
isAvailable
- price {
- currency
- amount
- localized
+ pricing {
+ discountLocalCurrency {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ price {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ priceUndiscounted {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
+ priceLocalCurrency {
+ currency
+ gross {
+ amount
+ localized
+ }
+ }
}
attributes {
attribute {