Jump to content

Adding javascript calls to shopping cart


pucilpet

Recommended Posts

Hi,
I need to add a javascript calls to shopping cart. Where should I add these pieces of code? Also how can I pull product id, price, name (and category if possible)?

I appreciate your help!
 
 
I need to run this javascript code when a product gets added to cart:
 
 

window._cshq = window._cshq || [];   // always confirm that the events queue exists, or create it


window._cshq.push(["_addToCart",    // add the product
   {
      "ProductId" : product.sku,
      "Quantity" : "1",
      "UnitPrice" : "24.50",
      "Name" : "product name"
      "Denomination" : "EUR"
   }
]);

 
and this call when a product is removed from the cart:
 
 

window._cshq = window._cshq || [];   // always confirm that the events queue exists, or create it


window._cshq.push(["_removeFromCart",    // remove the product
   {
      "ProductId" : product.sku,
      "Quantity" : "1"
   }
]);
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...