File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -38,12 +38,16 @@ public function getEventType(): string
38
38
*/
39
39
public function getPayload (array $ params ): array
40
40
{
41
- return [
41
+ $ payload = [
42
42
'content_type ' => $ params ['content_type ' ],
43
43
'content_name ' => $ params ['content_name ' ],
44
44
'content_ids ' => $ params ['content_ids ' ],
45
- 'currency ' => $ this ->magentoDataHelper ->getCurrency (),
46
- 'value ' => $ params ['value ' ]
45
+ 'currency ' => $ this ->magentoDataHelper ->getCurrency ()
47
46
];
47
+ // include value only if it is present in the parameters as this is optional in the payload for CustomizeProduct event
48
+ if (isset ($ params ['value ' ])) {
49
+ $ payload ['value ' ] = $ params ['value ' ];
50
+ }
51
+ return $ payload ;
48
52
}
49
53
}
Original file line number Diff line number Diff line change @@ -27,14 +27,16 @@ define([
27
27
function _getPrice ( element ) {
28
28
// For Swatch and Text Type - PLP page
29
29
productId = $ ( element ) . parents ( '.product-item-details' ) . find ( '.price-final_price' ) . data ( 'product-id' ) ;
30
- price = $ ( '#old-price-' + productId + '-widget-product-grid' ) . data ( 'price-amount' ) ;
31
-
32
30
// for DropdownType, Swatch and Text Type - PDP page
33
- if ( ! price ) {
31
+ if ( ! productId ) {
34
32
productId = $ ( element ) . parents ( '.product-info-main' ) . find ( '.price-final_price' ) . data ( 'product-id' ) ;
35
- price = $ ( '#product-price-' + productId ) . data ( 'price-amount' ) ;
36
33
}
37
- return price ;
34
+ price = $ ( '#product-price-' + productId ) . data ( 'price-amount' ) ;
35
+ if ( ! price ) {
36
+ // get product price based on the catalog price display type (including/excluding tax)
37
+ price = $ ( '#price-excluding-tax-product-price-' + productId ) . data ( 'price-amount' ) ;
38
+ }
39
+ return price . toFixed ( 2 ) ;
38
40
}
39
41
40
42
function _getProductName ( element ) {
You can’t perform that action at this time.
0 commit comments