Skip to content

Commit e8472c5

Browse files
priyambadPriyambad Pandey
andauthored
Enable tracking of add to cart (#804)
* ADO-312: fixes issue with add to cart event * Makes ajax call synchronous * Updates async property based on the backUrl --------- Co-authored-by: Priyambad Pandey <[email protected]>
1 parent 26dff8d commit e8472c5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

app/code/Meta/Conversion/view/frontend/templates/pixel/add_to_cart.phtml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ $trackerUrl = $block->getTrackerUrl();
3737
let simpleProductId;
3838
// Get id of last added product
3939
const productId = data.productIds[data.productIds.length - 1];
40-
if (!data.response.backUrl) {
4140
// check product data from swatch widget
4241
const swatchData = $('[data-role=swatch-options]').data('mage-SwatchRenderer');
4342
if (swatchData && swatchData.getProductId()) {
@@ -72,6 +71,7 @@ $trackerUrl = $block->getTrackerUrl();
7271
},
7372
type: 'get',
7473
dataType: 'json',
74+
async: !data.response.backUrl,
7575
success: function (res) {
7676
const addToCartConfigPixel = {
7777
"url": window.addToCartData.url,
@@ -102,7 +102,6 @@ $trackerUrl = $block->getTrackerUrl();
102102
metaPixelTracker(addToCartConfigPixel);
103103
}
104104
});
105-
}
106105
});
107106
});
108107
</script>

0 commit comments

Comments
 (0)