Skip to content

Commit 949089b

Browse files
MC-42198: Amount Attribute on Message disappear when user include Tax to Catalog Prices
1 parent 45a40fd commit 949089b

File tree

1 file changed

+6
-3
lines changed
  • app/code/Magento/Paypal/view/frontend/web/js/view/amountProviders

1 file changed

+6
-3
lines changed

app/code/Magento/Paypal/view/frontend/web/js/view/amountProviders/product.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ define([
2020

2121
defaults: {
2222
priceBoxSelector: '.price-box',
23+
priceTypeSelector: '[data-price-type]',
2324
qtyFieldSelector: '#product_addtocart_form [name="qty"]',
2425
amount: null
2526
},
2627
qty: 1,
2728
price: 0,
29+
priceType: '',
2830

2931
/**
3032
* Initialize
@@ -37,13 +39,14 @@ define([
3739
this._super();
3840

3941
priceBox = $(this.priceBoxSelector);
42+
this.priceType = $(this.priceTypeSelector, priceBox).data('priceType');
4043
priceBox.on('priceUpdated', this._onPriceChange.bind(this));
4144

4245
if (priceBox.priceBox('option') &&
4346
priceBox.priceBox('option').prices &&
44-
priceBox.priceBox('option').prices.finalPrice
47+
priceBox.priceBox('option').prices[this.priceType]
4548
) {
46-
this.price = priceBox.priceBox('option').prices.finalPrice.amount;
49+
this.price = priceBox.priceBox('option').prices[this.priceType]['amount'];
4750
}
4851

4952
$(this.qtyFieldSelector).on('change', this._onQtyChange.bind(this));
@@ -74,7 +77,7 @@ define([
7477
* @private
7578
*/
7679
_onPriceChange: function (event, data) {
77-
this.price = data.finalPrice.amount;
80+
this.price = data[this.priceType]['amount'];
7881
this._updateAmount();
7982
},
8083

0 commit comments

Comments
 (0)