Skip to content

Commit d2316e9

Browse files
authored
ENGCOM-4507: Update price-bundle.js so that correct tier price is calculated while displaying in bundle product #21469
2 parents ed47c5d + f5d2d74 commit d2316e9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/code/Magento/Bundle/view/base/web/js/price-bundle.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,17 @@ define([
374374
function applyTierPrice(oneItemPrice, qty, optionConfig) {
375375
var tiers = optionConfig.tierPrice,
376376
magicKey = _.keys(oneItemPrice)[0],
377+
tiersFirstKey = _.keys(optionConfig)[0],
377378
lowest = false;
378379

380+
if (!tiers) {//tiers is undefined when options has only one option
381+
tiers = optionConfig[tiersFirstKey].tierPrice;
382+
}
383+
384+
tiers.sort(function (a, b) {//sorting based on "price_qty"
385+
return a['price_qty'] - b['price_qty'];
386+
});
387+
379388
_.each(tiers, function (tier, index) {
380389
if (tier['price_qty'] > qty) {
381390
return;

0 commit comments

Comments
 (0)