You are here

public function MailchimpEcommerce::addCart in Mailchimp 8

Adds a new cart to a store.

Parameters

string $store_id: The unique identifier for the store.

string $id: The unique identifier for the cart.

array $customer: Associative array of customer information.

  • id (string): A unique identifier for the customer.

array $cart: Associative array of cart information.

  • currency_code (string): The three-letter ISO 4217 currency code.
  • order_total (float): The total for the order.
  • lines (array): An array of the order's line items.

bool $batch: TRUE to create a new pending batch operation.

Return value

object The API cart response object.

See also

http://developer.mailchimp.com/documentation/mailchimp/reference/ecommer...

File

lib/mailchimp-api-php/src/MailchimpEcommerce.php, line 195

Class

MailchimpEcommerce
Mailchimp Ecommerce library.

Namespace

Mailchimp

Code

public function addCart($store_id, $id, array $customer, array $cart, $batch = FALSE) {
  $tokens = [
    'store_id' => $store_id,
  ];
  $parameters = [
    'id' => $id,
    'customer' => (object) $customer,
  ];
  $parameters += $cart;
  return $this
    ->request('POST', '/ecommerce/stores/{store_id}/carts', $tokens, $parameters, $batch);
}