You are here

function mailchimp_ecommerce_add_store in Mailchimp E-Commerce 7

Add a new store to Mailchimp.

Parameters

string $store_id: The ID of the store.

array $store: Associative array of store information.

  • list_id (string) The id for the list associated with the store.
  • name (string) The name of the store.
  • currency_code (string) The three-letter ISO 4217 code for the currency that the store accepts.

string $platform: The eCommerce platform being used to create this store. This module's submodules use 'Drupal Ubercart' and 'Drupal Commerce'.

2 calls to mailchimp_ecommerce_add_store()
MailchimpEcommerceTestCase::testAddStore in tests/mailchimp_ecommerce.test
Tests adding a store to Mailchimp.
mailchimp_ecommerce_admin_settings_submit in includes/mailchimp_ecommerce.admin.inc
Submit handler for the Mailchimp eCommerce form.

File

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

Code

function mailchimp_ecommerce_add_store($store_id, $store, $platform) {
  try {

    /* @var \Mailchimp\MailchimpEcommerce $mc_ecommerce */
    $mc_ecommerce = mailchimp_get_api_object('MailchimpEcommerce');
    $parameters = [
      'platform' => $platform,
    ];
    $mc_store = $mc_ecommerce
      ->addStore($store_id, $store, $parameters);
    module_invoke_all('mailchimp_ecommerce_add_store', $mc_store);
  } catch (Exception $e) {
    mailchimp_ecommerce_log_error_message('Unable to add a new store: ' . $e
      ->getMessage());
    mailchimp_ecommerce_show_error($e
      ->getMessage());
  }
}