Applicable tier price is not applied on the Edit Item page on page load and it is not recalculated after quantity changes from the minicart.
Preconditions and environment
Tested on this versions:
- Magento dev-2.4-develop
Description (*)
Consider a product with tier pricing configured. For example:
- Original price: 100
- Tier price: Fixed price of 20 when the quantity is 2
When the product is added to the cart with a quantity of 3, the tier price (20) is correctly applied in the cart. However, if the Edit Item page is opened from the minicart, the page displays the original price (100) instead of the applicable tier price (20).
Additionally, while on the Edit Item page, if the minicart is opened and the product quantity is updated from 3 to 4, the updated quantity is correctly synchronized with the Edit Item page. However, the displayed product price is not recalculated and continues to show the original price (100) instead of the applicable tier price (20).
Screenshot-1: Product page
Screenshot-2: Backend product page
Screenshot-3: Edit item product page
Screenshot – 4 : Quantity update from minicart
Steps to reproduce
- Take 2.4-developer branch clone.
- Create a product and configure tier pricing (for example, set a fixed price of 20 for a quantity of 2),as shown in Screenshot 2.
- Open the product on the storefront and add 3 qty to the cart.
- Open the Edit Item page from the minicart (Screenshot 1).
- Observe that:
- The quantity is displayed as 3.
- The product price is displayed as 100 instead of the applicable tier price 20. (ScreenShot-3)
- While remaining on the Edit Item page, open the minicart and update the quantity from 3 to 4 (Screenshot 4).
- Observe that:
- The updated quantity is correctly reflected on the Edit Item page.
- The displayed product price remains 100 instead of being recalculated to the applicable tier price 20.
Expected result
- When opening the Edit Item page for a cart item with an applicable tier price, the page should display the tier price instead of the original product price.
- When the product quantity is updated from the minicart and the change is synchronized with the Edit Item page, the product price should be recalculated and display the applicable tier price.
Actual result
- When opening the Edit Item page displays the original product price instead of the applicable tier price.
- When the quantity is updated from the minicart, the quantity is synchronized with the Edit Item page, but the displayed product price is not recalculated and continues to show the original price instead of the applicable tier price.
Additional information
- For the issue where a product with tier pricing is added to the cart and the Edit Item page displays the original price instead of the applicable tier price, the root cause is in:
File :- vendor/magento/module-catalog/view/base/web/js/price-box.js
In this file the updateProductTierPrice() function is not invoked on the initial page load, so the tier price is never calculated and displayed.
- For the issue where the product quantity is updated from the minicart while on the Edit Item page, the updated quantity is correctly synchronized with the Edit Item page, but the product price is not recalculated.
File :- vendor/magento/module-checkout/view/frontend/web/js/view/configure/product-customer-data.js
In the updateQty() function, the quantity input is updated, but the necessary event to trigger price recalculation is not fired. As a result, the price remains unchanged even though the quantity has been updated.
Solution :-
- In the vendor/magento/module-catalog/view/base/web/js/price-box.js file we need to call updateProductTierPrice() function at the intialization.
- Also in the vendor/magento/module-checkout/view/frontend/web/js/view/configure/product-customer-data.js file we need to trigger input event so that after qty update from the minicart it's recalculate price correctly.
NOTE :- The issue is reproducible for simple products, virtual products, and grouped products that include simple or virtual products.
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Source: magento/magento2