Closed
Description
Preconditions (*)
Magento 2.4
Steps to reproduce (*)
- Create a configurable product and associate 1 simple product with no tier pricing and 1 simple product with tier pricing
- Style the tier prices block with a background or border (for example
border: aqua; background: #99cfff;
) - Toggle between the 2 simple products. For the product with no tier pricing, the content disappears but the CSS styling remains (e.g. in Magento Blank theme, there is an empty box with a gray background).
Expected result (*)
- The tier price block, including associated CSS, should disappear from the frontend when choosing a simple product that doesn't have tier prices.
Actual result (*)
- The tier price block, including CSS styling such as background or border, is visible even when there are no tier prices to display.
Additional information
Even when there are no tier prices, any CSS applied to tier prices block are visible on the frontend.
A simple edit to _displayTierPriceBlock function in configurable.js can fix this problem.
Solution:
in _displayTierPriceBlock function of configurable.js, change the following if statement:
if (typeof optionId != 'undefined' &&
this.options.spConfig.optionPrices[optionId].tierPrices != [] // eslint-disable-line eqeqeq
)
to the following, which includes a check for tier prices array with 0 length:
if (typeof optionId != 'undefined' &&
this.options.spConfig.optionPrices[optionId].tierPrices != [] && // eslint-disable-line eqeqeq
this.options.spConfig.optionPrices[optionId].tierPrices.length > 0
)
- [S4 ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.4-develop branchGate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for developmentA defect with this priority could have functionality issues which are not to expectations.Indicates original Magento version for the Issue report.The issue has been reproduced on latest 2.4-develop branchMajor restrictions or short-term circumventions are required until a fix is available.Has been reviewed and prioritized during Triage with Product Managers
Type
Projects
Status
Done