-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
Remove cart not working it was getting the data cart response
this code block was push data wrong
$(__DL__.removeCartTrigger).click(function(e){
var link = $(this).attr("href");
console.log(" link ", link)
let targetUrl = e.target.parentElement.href;
console.log("target URL", targetUrl)
jQuery.getJSON(link, function (response) {
// get Json response
console.log("response this is return the current list of items ", response)
__DL__.removeCart = response;
var removeFromCart = {
'pageType' : 'Cart',
'event' : 'Remove from Cart11',
'ecommerce': __DL__.removeCart.items.map(function (line_item) {
return {
'id' : line_item.id,
'sku' : line_item.sku,
'variant' : line_item.variant_id,
'name' : line_item.title,
'price' : (line_item.price/100),
'quantity' : line_item.quantity
}
})
};
dataLayer.push(removeFromCart);
if (__DL__.debug) {
console.log("Cart removes "+" :"+JSON.stringify(removeFromCart, null, " "));
}
});
});
Metadata
Metadata
Assignees
Labels
No labels