Merx

$cart->add()

Adds item to cart.

$cart->add(Wagnerwagner\Merx\ListItem|array|string $data): Wagnerwagner\Merx\Cart

Parameters

Name Type Default
$data ListItem or array or string -

Return type

Wagnerwagner\Merx\Cart

Exceptions

Type Description
Exception error.merx.cart.add

Description

$cart->add('products/nice-shoes'); // ID of a ProductPage
$cart->add('page://L1cJEiOOQI3VzljV'); // UUID of a ProductPage
$cart->add(['key' => 'individual-shoes', 'page' => 'products/nice-shoes']); // Array including key
$cart->add(new ListItem(key: 'nice-socks', price: 10])); // Custom LitItem

Parent class

Wagnerwagner\Merx\Cart