You are here

public function MailchimpEcommerce::addOrderLine in Mailchimp 8

Add a new line item to an existing order.

Parameters

string $store_id: The ID of the store.

string $order_id: The ID for the order in a store.

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 order line response object.

See also

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

File

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

Class

MailchimpEcommerce
Mailchimp Ecommerce library.

Namespace

Mailchimp

Code

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