Description
In Graphql fetch data for special price & tier prices in products query. The values come always in base currency.
Preconditions (*)
-
Magento based on '2.4-develop' branch
-
Have a product created with name "Beginner's Yoga" (or refer to the same named product that becomes available with sample data) and set the following prices
a. price: 6
b. Advanced pricing > special price: 5
c. Advanced Pricing > Catalog and Tier Price, for all websites and all groups, fixed type price,
- for qty 2 price 4
- for qty 3 price 3 -
Add new store view with code "eur_view"
-
Navigate to Store -> Settings -> Configuration -> General -> Currency Setup and allow EURO in Allowed Currencies and Save Configuration
-
Change the Scope to the second Eur View and set Default Display Currency to Euro
-
Ensure there are currency rates available (e.g. on frontend catalog if the store view is switched price would change from 6 to 4.24 -> indicating that the USD -> EUR rate is 1.415)
Steps to reproduce (*)
-
Set header "Store = default" and execute this query
query{ products(search: "Beginner's Yoga"){ total_count items { name price_range { minimum_price { regular_price { currency value } final_price { currency value } } } special_price price_tiers { final_price { currency value } quantity } sku } } }
-
Prices now are expected in Default Store view in USD, response should look like
{ "name": "Beginner's Yoga", "price_range": { "minimum_price": { "regular_price": { "currency": "USD", "value": 6 }, "final_price": { "currency": "USD", "value": 5 } } }, "special_price": 5, "price_tiers": [ { "final_price": { "currency": "USD", "value": 4 }, "quantity": 2 }, { "final_price": { "currency": "USD", "value": 3 }, "quantity": 3 } ], "sku": "240-LV04" }
-
Set header "Store = eur_view" and execute the query again
-
Prices now are expected in Eur View in EUR currency, response should look like
{ "name": "Beginner's Yoga", "price_range": { "minimum_price": { "regular_price": { "currency": "EUR", "value": 4.24 }, "final_price": { "currency": "EUR", "value": 3.53 } } }, "special_price": 5, "price_tiers": [ { "final_price": { "currency": "EUR", "value": 4 }, "quantity": 2 }, { "final_price": { "currency": "EUR", "value": 3 }, "quantity": 3 } ], "sku": "240-LV04" }
Observe how the regular_price.minimum_price
and regular_price.final_price
have changed its value, but not the special_price
or the values respectively for the price_tiers
Expected result (*)
special_price
should display values corrected by the USD->EUR rate (E.g. something like 3.53)price_tiers.final_price.value
should display values corrected by the USD->EUR rate
Actual result (*)
special_price
still displays 5price_tiers.final_price.value
is still displayed in USD and displays 4 for qty 2, and 3 for qty 3