<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [BaseXAPI](./x-components.basexapi.md) &gt; [addProductToCart](./x-components.basexapi.addproducttocart.md)

## BaseXAPI.addProductToCart() method

Tracks that a product was added to cart from PDP.

**Signature:**

```typescript
addProductToCart(productId?: string): void;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  productId | string | _(Optional)_ The product id that was added to cart. |

**Returns:**

void

