You are here

public function MailchimpEcommerce::addCartLine in Mailchimp 8

Add a new line item to an existing cart.

Parameters

string $store_id: The unique identifier for the store.

string $cart_id: The unique identifier for the cart.

string $id: A unique identifier for the order line item.

array $product: Associative array of product information.

  • product_id (string) The unique identifier for the product.
  • product_variant_id (string) The unique id for the product variant.
  • quantity (int) The quantity of a cart line item.
  • price (float) The price of a cart line item.

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

Return value

object The API cart line response object.

See also

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

File

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

Class

MailchimpEcommerce
Mailchimp Ecommerce library.

Namespace

Mailchimp

Code

public function addCartLine($store_id, $cart_id, $id, $product, $batch = FALSE) {
  $tokens = [
    'store_id' => $store_id,
    'cart_id' => $cart_id,
  ];
  $parameters = [
    'id' => $id,
  ];
  $parameters += $product;
  return $this
    ->request('POST', '/ecommerce/stores/{store_id}/carts/{cart_id}/lines', $tokens, $parameters, $batch);
}