Skip to content

Commit c1d1dd9

Browse files
authored
Merge pull request #883 from sdinteractive/ADO-433-customize-product-event-issue
ADO-433 customize product event issue
2 parents eb05201 + 9916f20 commit c1d1dd9

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

app/code/Meta/Conversion/Model/Tracker/CustomizeProduct.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ public function getEventType(): string
3838
*/
3939
public function getPayload(array $params): array
4040
{
41-
return [
41+
$payload = [
4242
'content_type' => $params['content_type'],
4343
'content_name' => $params['content_name'],
4444
'content_ids' => $params['content_ids'],
45-
'currency' => $this->magentoDataHelper->getCurrency(),
46-
'value' => $params['value']
45+
'currency' => $this->magentoDataHelper->getCurrency()
4746
];
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;
4852
}
4953
}

app/code/Meta/Conversion/view/frontend/web/js/customizeProduct.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@ define([
2727
function _getPrice(element) {
2828
// For Swatch and Text Type - PLP page
2929
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-
3230
// for DropdownType, Swatch and Text Type - PDP page
33-
if (!price) {
31+
if (!productId) {
3432
productId = $(element).parents('.product-info-main').find('.price-final_price').data('product-id');
35-
price = $('#product-price-' + productId).data('price-amount');
3633
}
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);
3840
}
3941

4042
function _getProductName(element) {

0 commit comments

Comments
 (0)