You are here

function mailchimp_ecommerce_update_order in Mailchimp E-Commerce 7

Updates an existing order in the current Mailchimp store.

Parameters

string $order_id: The order ID.

array $order: Associative array of order 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.

See also

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

4 calls to mailchimp_ecommerce_update_order()
mailchimp_ecommerce_commerce_batch_add_orders in modules/mailchimp_ecommerce_commerce/mailchimp_ecommerce_commerce.module
Batch callback used to add orders to MailChimp.
mailchimp_ecommerce_commerce_commerce_order_update in modules/mailchimp_ecommerce_commerce/mailchimp_ecommerce_commerce.module
Implements hook_commerce_order_update().
mailchimp_ecommerce_ubercart_batch_add_orders in modules/mailchimp_ecommerce_ubercart/mailchimp_ecommerce_ubercart.module
Batch callback used to add orders to Mailchimp.
mailchimp_ecommerce_ubercart_uc_order in modules/mailchimp_ecommerce_ubercart/mailchimp_ecommerce_ubercart.module
Implements hook_uc_order().

File

./mailchimp_ecommerce.module, line 835
Mailchimp eCommerce core functionality.

Code

function mailchimp_ecommerce_update_order($order_id, array $order) {
  try {
    $store_id = mailchimp_ecommerce_get_store_id();
    if (empty($store_id)) {
      throw new Exception('Cannot update an order without a store ID.');
    }
    if (mailchimp_ecommerce_use_queue()) {
      mailchimp_ecommerce_create_queue_item([
        'op' => 'updateOrder',
        'order_id' => $order_id,
        'store_id' => $store_id,
        'order' => $order,
      ]);
    }
    else {

      /* @var \Mailchimp\MailchimpEcommerce $mc_ecommerce */
      $mc_ecommerce = mailchimp_get_api_object('MailchimpEcommerce');
      $mc_ecommerce
        ->updateOrder($store_id, $order_id, $order);
    }
  } catch (Exception $e) {
    mailchimp_ecommerce_log_error_message('Unable to update an order: ' . $e
      ->getMessage());
    mailchimp_ecommerce_show_error($e
      ->getMessage());
  }
}