Adds a product to the shopping cart. If the product already exists, the quantity will be incremented.
Data Format
Property | Type | Required | Description |
---|---|---|---|
id | number | Yes | Id of the product |
quantity | number | No | The quantity |
variants | string[] | No | List of variants, e.g. if the color is 'Red' and the size is '42' provide [‘Red, ‘42’] |
Example
nextchapter.app.cart.v1.addProduct({
id: 1,
quantity: 2,
variants: ['Red','42']
});