File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
app/code/Magento/Paypal/view/frontend/web/js/view/amountProviders Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,13 @@ define([
20
20
21
21
defaults : {
22
22
priceBoxSelector : '.price-box' ,
23
+ priceTypeSelector : '[data-price-type]' ,
23
24
qtyFieldSelector : '#product_addtocart_form [name="qty"]' ,
24
25
amount : null
25
26
} ,
26
27
qty : 1 ,
27
28
price : 0 ,
29
+ priceType : '' ,
28
30
29
31
/**
30
32
* Initialize
@@ -37,13 +39,14 @@ define([
37
39
this . _super ( ) ;
38
40
39
41
priceBox = $ ( this . priceBoxSelector ) ;
42
+ this . priceType = $ ( this . priceTypeSelector , priceBox ) . data ( 'priceType' ) ;
40
43
priceBox . on ( 'priceUpdated' , this . _onPriceChange . bind ( this ) ) ;
41
44
42
45
if ( priceBox . priceBox ( 'option' ) &&
43
46
priceBox . priceBox ( 'option' ) . prices &&
44
- priceBox . priceBox ( 'option' ) . prices . finalPrice
47
+ priceBox . priceBox ( 'option' ) . prices [ this . priceType ]
45
48
) {
46
- this . price = priceBox . priceBox ( 'option' ) . prices . finalPrice . amount ;
49
+ this . price = priceBox . priceBox ( 'option' ) . prices [ this . priceType ] [ ' amount' ] ;
47
50
}
48
51
49
52
$ ( this . qtyFieldSelector ) . on ( 'change' , this . _onQtyChange . bind ( this ) ) ;
@@ -74,7 +77,7 @@ define([
74
77
* @private
75
78
*/
76
79
_onPriceChange : function ( event , data ) {
77
- this . price = data . finalPrice . amount ;
80
+ this . price = data [ this . priceType ] [ ' amount' ] ;
78
81
this . _updateAmount ( ) ;
79
82
} ,
80
83
You can’t perform that action at this time.
0 commit comments