<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [XAPI](./x-components.xapi.md) &gt; [addProductToCart](./x-components.xapi.addproducttocart.md)

## XAPI.addProductToCart property

To track that a product was added to the cart from PDP.

**Signature:**

```typescript
addProductToCart: (productId?: string) => void;
```

## Remarks

if no productId is provided, then the current page url will be used as id for getting the previously stored result information.

