Script Tag Override Shopify.onItemAdded

Mubbashar_Husai
Shopify Partner
2 0 1

Hi All,

 

I am adding script tag in my store via api. The script tag loading fine. In script tag i added this code 

 

Shopify.onItemAdded = function(line_item) {
  console.log(line_item.title + ' was added to your shopping cart.');
};

so whenever a product is added to cart i got the callback. so i want to do some work here. But this function never called.

i also tried to override

 

Shopify.onCartUpdate = function( cart ) {
  console.log( cart );
};

 

this callback as well but still nothing happen. can you guys tell what i might be doing wrong. 
I want that whenever a product is added to card i get control so i can do some work.

thanks!

hassanba
New Member
3 0 0

Was there anyone who found a solution to this
?

0 Likes
joshuaUV
New Member
4 0 0

was this ever solved?

0 Likes