# cart.add:before

> Runs before an item is added to the cart. The item is still whatever the caller passed.

- Source: `config/hooks.php#L73` <https://github.com/wagnerwagner/merx/blob/2.0.0-alpha.11/config/hooks.php#L73>

```php
'wagnerwagner.merx.cart.add:before' => function (Wagnerwagner\Merx\Cart $cart, Wagnerwagner\Merx\ListItem|array|string $data): void {}
```

## Parameters

| Name | Type | Default |
| --- | --- | --- |
| `$cart` | `Wagnerwagner\Merx\Cart` | `–` |
| `$data` | `Wagnerwagner\Merx\ListItem\|array\|string` | `–` |

## Return type

`void`
