Product object represents details of a specific product in cart.
Get product name and SKU in cart example:
Ecwid.OnCartChanged.add(function(cart) {
console.log(cart.items[0].product.name + " in the cart has SKU: " + cart.items[0].product.sku);
});
// prints
// Apple product in the cart has SKU: TEST-1234
Subscribe to the Ecwid.OnAPILoaded
JS API event to ensure availability of this function.
Fields:
Name | Type | Description |
---|---|---|
id | integer | Internal unique product ID |
name | string | Product name |
price | integer | Product price before applied tax (if store has "net prices" setting enabled) |
shortDescription | string | Product description truncated to 120 characters |
sku | string | Product SKU |
url | string | URL to this product details page in store front (store front URL is generated from a field in Ecwid Control panel > Settings > General > Store profile) |
weight | integer | Weight of a product |