Tracking when a visitor adds a product to cart
With this method you can register products that have been added to the shopping cart, even if users don’t visit a cart page.
Please make sure to replace https://webshop.com/t-shirt.html or p-1234 with the current canonical URL or product number of the product the visitor are currently adding to cart.
Example using product URL
Example using product number
1
// Make sure to set the canonical URL of the product added to cart
2
ADDWISH_PARTNER_NS.api.cart.addProduct({
3
url: 'https://webshop.com/t-shirt.html'
4
});
Copied!
1
// Make sure to set product ID of the product added to cart
2
ADDWISH_PARTNER_NS.api.cart.addProduct({
3
productNumber: 'p-1234'
4
});
Copied!

Arguments

Argument
Type
Description
url
String
The canonical URL of the product
productNumber
String
The unique ID of the product
Last modified 1yr ago
Copy link