Skip to content

Update price-bundle.js so that correct tier price is calculated while displaying in bundle product #21469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 20, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/code/Magento/Bundle/view/base/web/js/price-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,17 @@ define([
var tiers = optionConfig.tierPrice,
magicKey = _.keys(oneItemPrice)[0],
lowest = false;

//tiers is undefined when options has only one option
if (undefined == tiers) {
var firstKey = Object.keys(optionConfig)[0];
tiers = optionConfig[firstKey].tierPrice;
}

//sorting based on "price_qty"
tiers.sort( function (a, b) {
return a['price_qty'] - b['price_qty'];
});

_.each(tiers, function (tier, index) {
if (tier['price_qty'] > qty) {
Expand Down