@empathyco/x-components
Version:
Empathy X Components
29 lines (16 loc) • 762 B
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[](./index.md) > [@empathyco/x-components](./x-components.md) > [XAPI](./x-components.xapi.md) > [addProductToCart](./x-components.xapi.addproducttocart.md)
To track that a product was added to the cart from PDP.
**Signature:**
```typescript
addProductToCart(productId?: string): void;
```
| Parameter | Type | Description |
| --- | --- | --- |
| productId | string | _(Optional)_ The id of the product added to cart. |
**Returns:**
void
if no productId is provided, then the current page url will be used as id for getting the previously stored result information.