Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 79ae157

Browse files
authored
GraphQL: Update pricing schema changes (#5512)
* checkpoint * checkpoint * minor updates * review comments * one more review comment * more review comments * correct linting error * remove stray character from TOC
1 parent 32465ef commit 79ae157

File tree

5 files changed

+415
-88
lines changed

5 files changed

+415
-88
lines changed

_data/toc/graphql.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ pages:
227227
- label: Product interface implementations
228228
url: /graphql/product/product-interface-implementations.html
229229

230+
- label: ProductInterface
231+
url: /graphql/product/product-interface.html
232+
230233
- label: CustomizableOptionInterface
231234
url: /graphql/product/customizable-option-interface.html
232235

guides/v2.3/graphql/product/product-interface.md

Lines changed: 58 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ Attribute | Data type | Description
4242
`new_to_date` | String | The end date for new product listings
4343
`only_x_left_in_stock` | Float | The "Only X left Threshold" assigned to the product. This attribute is defined in the `InventoryGraphQl` module.
4444
`options_container` | String | If the product has multiple options, determines where they appear on the product page
45-
`price` | ProductPrices | The price of an item. A `ProductPrice` object is returned. See [ProductPrices](#ProductPrices) for more information.
45+
`price` | ProductPrices | Deprecated. Use `price_range` instead.<br/>The price of an item. A `ProductPrice` object is returned
46+
`price_range` | [PriceRange!](#PriceRange) | A `PriceRange` object, indicating the range of prices for the product
47+
`price_tiers` | [TierPrice] | An array of `TierPrice` objects
4648
`product_links` | [ProductLinksInterface] | An array of [ProductLinks](#ProductLinks) objects
4749
`related_products` | [ProductInterface] | An array of related products
4850
`short_description` | ComplexTextValue | An object that contains a short description of the product. Its use depends on the store's theme. The object can include simple HTML tags
@@ -55,8 +57,8 @@ Attribute | Data type | Description
5557
`swatch_image` | String | The file name of a swatch image. This attribute is defined in the `SwatchesGraphQl` module.
5658
`tax_class_id` | Int | An ID assigned to a tax class. This attribute is defined in the `TaxGraphQl` module.
5759
`thumbnail` | [ProductImage](#ProductImage) | An object that contains the URL and label for the product's thumbnail image
58-
`tier_price` | Float | The price when tier pricing is in effect and the items purchased threshold has been reached
59-
`tier_prices` | [ProductTierPrices] | An array of [ProductTierPrices](#ProductTier) objects
60+
`tier_price` | Float | Deprecated. Use `price_tiers` instead. The price when tier pricing is in effect and the items purchased threshold has been reached
61+
`tier_prices` | [ProductTierPrices] | Deprecated. Use `price_tiers` instead. An array of [ProductTierPrices](#ProductTier) objects
6062
`type_id` | String | One of `simple`, `virtual`, `bundle`, `downloadable`,`grouped`, `configurable`
6163
`updated_at` | String | The timestamp indicating when the product was last updated
6264
`upsell_products` | [ProductInterface] | An array of up-sell products
@@ -68,15 +70,46 @@ Attribute | Data type | Description
6870

6971
### ProductPrices object {#ProductPrices}
7072

73+
{:.bs-callout-info}
74+
The `ProductPrices` object has been deprecated. Use the `PriceRange` object instead.
75+
7176
The `ProductPrices` object contains the regular price of an item, as well as its minimum and maximum prices. Only composite products, which include bundle, configurable, and grouped products, can contain a minimum and maximum price.
7277

7378
Attribute | Data Type | Description
7479
--- | --- | ---
75-
`maximalPrice` | Price | Used for composite (bundle, configurable, grouped) products. This is the highest possible final price for all the options defined within a composite product. If you're specifying a price range, this would be the "to" value.
76-
`minimalPrice` | Price | Used for composite (bundle, configurable, grouped) products. This is the lowest possible final price for all the options defined within a composite product. If you're specifying a price range, this would be the "from" value.
77-
`regularPrice` | Price | The base price of a product.
80+
`maximalPrice` | Price | Deprecated. Use `PriceRange.maximum_price` instead. Used for composite (bundle, configurable, grouped) products. This is the highest possible final price for all the options defined within a composite product. If you're specifying a price range, this would be the "to" value
81+
`minimalPrice` | Price | Deprecated. Use `PriceRange.minimum_price` instead. Used for composite (bundle, configurable, grouped) products. This is the lowest possible final price for all the options defined within a composite product. If you're specifying a price range, this would be the "from" value
82+
`regularPrice` | Price | Deprecated. Use `PriceRange.maximum_price` or `PriceRange.minimum_price` instead. The base price of a product
83+
84+
### PriceRange object {#PriceRange}
85+
86+
The `PriceRange` object defines the price range for a product. If a product only has a single price, the minimum and maximum price will be the same.
87+
88+
Attribute | Data Type | Description
89+
--- | --- | ---
90+
`maximum_price` | ProductPrice | The highest possible final price for a product
91+
`minimum_price` | ProductPrice | The lowest possible final price for a product
92+
93+
### ProductPrice object {#ProductPrice}
94+
95+
The `ProductPrice` object includes the regular price, final price, and the difference between those two prices.
96+
97+
Attribute | Data Type | Description
98+
--- | --- | ---
99+
`discount` | ProductDiscount | The amount of the discount applied to the product. It represents the difference between the `final_price` and `regular_price`
100+
`final_price`| Money! | The price of the product after applying discounts
101+
`regular_price` | Money! | The regular price of the product, without any applied discounts
78102

79-
#### Price object {#Price}
103+
### ProductDiscount object {#ProductDiscount}
104+
105+
The `ProductDiscount` object expresses the discount applied to a product as a fixed amount, such as $5, and as a percentage, such as 10%. The discount originates from special pricing or a catalog price rule.
106+
107+
Attribute | Data Type | Description
108+
--- | --- | ---
109+
`amount_off` | Float | The actual value of the discount
110+
`percent_off` | Float | The discount expressed as a percentage
111+
112+
### Price object {#Price}
80113

81114
The `Price` object defines the price of a product as well as any tax-related adjustments.
82115

@@ -178,15 +211,28 @@ Attribute | Type | Description
178211

179212
### ProductTierPrices object {#ProductTier}
180213

214+
{:.bs-callout-info}
215+
The `ProductTierPrices` object and all of its attributes have been deprecated. Use `TierPrice` instead.
216+
181217
The `ProductTierPrices` object defines a tier price, which is a quantity discount offered to a specific customer group.
182218

183219
Attribute | Type | Description
184220
--- | --- | ---
185-
`customer_group_id` | Int | The ID of the customer group
186-
`percentage_value` | Float | The percentage discount of the item
187-
`qty` | Float | The number of items that must be purchased to qualify for tier pricing
188-
`value` | Float | The price of the fixed price item
189-
`website_id` | Int | The ID assigned to the website
221+
`customer_group_id` | Int | Deprecated. There is no replacement because this value is not relevant for the storefront. The ID of the customer group
222+
`percentage_value` | Float | Deprecated. Use `TierPrice.discount` instead. The percentage discount of the item
223+
`qty` | Float | Deprecated. Use `TierPrice.quantity` instead. The number of items that must be purchased to qualify for tier pricing
224+
`value` | Float | Deprecated. Use `TierPrice.final_price` instead. The price of the fixed price item
225+
`website_id` | Int | Deprecated. There is no replacement because this value is not relevant for the storefront. The ID assigned to the website
226+
227+
### TierPrice object {#TierPrice}
228+
229+
The `TierPrice` object defines a tier price, which is a price based on the quantity purchased.
230+
231+
Attribute | Type | Description
232+
--- | --- | ---
233+
`discount` | ProductDiscount | The price discount applied to this tier
234+
`final_price`| Money! | The price of the product at this tier
235+
`quantity` | Float | The minimum number of items that must be purchased to qualify for this price tier
190236

191237
### Website object {#websiteObject}
192238

guides/v2.3/graphql/queries/cart.md

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,183 @@ The `3T1free` rule is applied first, and Magento returns the price of a single s
523523
}
524524
```
525525

526+
### Tier price example
527+
528+
In the following example, tier prices has been established for product `24-UG01` and `24-UG05`, as shown in the following table:
529+
530+
Product | Quantity | Fixed/Discount | Amount
531+
--- | --- | --- | --- |
532+
24-UG01 | 5 | Discount | 5%
533+
24-UG01 | 10 | Discount | 10%
534+
24-UG01 | 15 | Discount | 15%
535+
24-UG05 | 5 | Fixed | $16
536+
24-UG05 | 10 | Fixed | $11
537+
538+
The cart in the example contains 12 units of `24-UG05` and 8 units of `24-UG-01`, so the price of `24-UG05` is $11, and the price of `24-UG01` is $18.05 (5% off).
539+
540+
**Request**
541+
542+
```graphql
543+
query {
544+
cart(cart_id: "v7jYJUjvPeHbdMJRcOfZIeQhs2Xc2ZKT"){
545+
items {
546+
id
547+
quantity
548+
product{
549+
name
550+
sku
551+
price_tiers {
552+
quantity
553+
final_price {
554+
value
555+
}
556+
discount {
557+
amount_off
558+
percent_off
559+
}
560+
}
561+
}
562+
prices{
563+
price{
564+
value
565+
}
566+
}
567+
}
568+
prices {
569+
discounts {
570+
label
571+
amount {
572+
value
573+
}
574+
}
575+
subtotal_excluding_tax {
576+
value
577+
}
578+
applied_taxes {
579+
label
580+
amount {
581+
value
582+
}
583+
}
584+
}
585+
}
586+
}
587+
```
588+
589+
**Response**
590+
591+
```json
592+
{
593+
"data": {
594+
"cart": {
595+
"items": [
596+
{
597+
"id": "65",
598+
"quantity": 12,
599+
"product": {
600+
"name": "Go-Get'r Pushup Grips",
601+
"sku": "24-UG05",
602+
"price_tiers": [
603+
{
604+
"quantity": 5,
605+
"final_price": {
606+
"value": 16
607+
},
608+
"discount": {
609+
"amount_off": 3,
610+
"percent_off": 15.79
611+
}
612+
},
613+
{
614+
"quantity": 10,
615+
"final_price": {
616+
"value": 11
617+
},
618+
"discount": {
619+
"amount_off": 8,
620+
"percent_off": 42.11
621+
}
622+
}
623+
]
624+
},
625+
"prices": {
626+
"price": {
627+
"value": 11
628+
}
629+
}
630+
},
631+
{
632+
"id": "66",
633+
"quantity": 8,
634+
"product": {
635+
"name": "Quest Lumaflex&trade; Band",
636+
"sku": "24-UG01",
637+
"price_tiers": [
638+
{
639+
"quantity": 5,
640+
"final_price": {
641+
"value": 18.05
642+
},
643+
"discount": {
644+
"amount_off": 0.95,
645+
"percent_off": 5
646+
}
647+
},
648+
{
649+
"quantity": 10,
650+
"final_price": {
651+
"value": 17.1
652+
},
653+
"discount": {
654+
"amount_off": 1.9,
655+
"percent_off": 10
656+
}
657+
},
658+
{
659+
"quantity": 15,
660+
"final_price": {
661+
"value": 16.15
662+
},
663+
"discount": {
664+
"amount_off": 2.85,
665+
"percent_off": 15
666+
}
667+
}
668+
]
669+
},
670+
"prices": {
671+
"price": {
672+
"value": 18.05
673+
}
674+
}
675+
}
676+
],
677+
"prices": {
678+
"discounts": [
679+
{
680+
"label": "200",
681+
"amount": {
682+
"value": 55.28
683+
}
684+
}
685+
],
686+
"subtotal_excluding_tax": {
687+
"value": 276.4
688+
},
689+
"applied_taxes": [
690+
{
691+
"label": "US-MI-*-Rate 1",
692+
"amount": {
693+
"value": 18.24
694+
}
695+
}
696+
]
697+
}
698+
}
699+
}
700+
}
701+
```
702+
526703
## Input attributes
527704

528705
Attribute | Data Type | Description

0 commit comments

Comments
 (0)