-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Component: AdminFixed in 2.4.xThe issue has been fixed in 2.4-develop branchThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P3May be fixed according to the position in the backlog.May be fixed according to the position in the backlog.Progress: doneReported on 2.3.5Indicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branchSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.Affects non-critical data or functionality and does not force users to employ a workaround.Triage: DoneHas been reviewed and prioritized during Triage with Product ManagersHas been reviewed and prioritized during Triage with Product Managers
Description
Preconditions (*)
- Magento 2.3.5
Steps to reproduce (*)
- Create a configurable product with swatch options
- Add tier prices to one of the options
- Go to configurable product PDP
- Select the tier price product
- Add the product to cart
- Click on edit button from mini cart/ cart page
- Check the tier price is not shown on edit product page
- Load the page with #attribute_id=value_id to preset the swatch value
Expected result (*)
- Tier price block should show
Actual result (*)
- Tier price does not show
Solution (*)
The issue lies in file;
/vendor/magento/module-swatches/view/base/web/js/swatch-renderer.js
The function _UpdatePrice: function () { has a dependency on if this.options.tierPriceTemplate being defined on hashed options being set on load, which it isnt.
Here's the change to ensure it gets defined;
Before:
_UpdatePrice: function () {
var $widget = this,
$product = $widget.element.parents($widget.options.selectorProduct),
$productPrice = $product.find(this.options.selectorProductPrice),
result = $widget._getNewPrices(),
tierPriceHtml,
isShow;
$productPrice.trigger(
'updatePrice',
{
'prices': $widget._getPrices(result, $productPrice.priceBox('option').prices)
}
);
isShow = typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount;
$product.find(this.options.slyOldPriceSelector)[isShow ? 'show' : 'hide']();
if (typeof result != 'undefined' && result.tierPrices && result.tierPrices.length) {
if (this.options.tierPriceTemplate) {
tierPriceHtml = mageTemplate(
this.options.tierPriceTemplate,
{
'tierPrices': result.tierPrices,
'$t': $t,
'currencyFormat': this.options.jsonConfig.currencyFormat,
'priceUtils': priceUtils
}
);
$(this.options.tierPriceBlockSelector).html(tierPriceHtml).show();
}
After;
_UpdatePrice: function () {
var $widget = this,
$product = $widget.element.parents($widget.options.selectorProduct),
$productPrice = $product.find(this.options.selectorProductPrice),
result = $widget._getNewPrices(),
tierPriceHtml,
isShow;
$productPrice.trigger(
'updatePrice',
{
'prices': $widget._getPrices(result, $productPrice.priceBox('option').prices)
}
);
isShow = typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount;
$product.find(this.options.slyOldPriceSelector)[isShow ? 'show' : 'hide']();
if (typeof result != 'undefined' && result.tierPrices && result.tierPrices.length) {
// ADDED HERE
if (this.options.tierPriceTemplate = $(this.options.tierPriceTemplateSelector).html()) {
tierPriceHtml = mageTemplate(
this.options.tierPriceTemplate,
{
'tierPrices': result.tierPrices,
'$t': $t,
'currencyFormat': this.options.jsonConfig.currencyFormat,
'priceUtils': priceUtils
}
);
$(this.options.tierPriceBlockSelector).html(tierPriceHtml).show();
}
Additional information
more detailed steps and screens #28270 (Comment)
Metadata
Metadata
Assignees
Labels
Component: AdminFixed in 2.4.xThe issue has been fixed in 2.4-develop branchThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P3May be fixed according to the position in the backlog.May be fixed according to the position in the backlog.Progress: doneReported on 2.3.5Indicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branchSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.Affects non-critical data or functionality and does not force users to employ a workaround.Triage: DoneHas been reviewed and prioritized during Triage with Product ManagersHas been reviewed and prioritized during Triage with Product Managers
Type
Projects
Status
Done