Overview
  • Namespace
  • Class

Namespaces

  • MailChimp
    • AuthorizedApps
    • Automations
    • Batches
    • CampaignFolders
    • Campaigns
    • Conversations
    • Ecommerce
    • FileManager
    • Lists
    • Reports
    • TemplateFolders
    • Templates

Classes

  • MailChimp\AuthorizedApps\AuthorizedApps
  • MailChimp\Automations\Automations
  • MailChimp\Batches\Batches
  • MailChimp\CampaignFolders\CampaignFolders
  • MailChimp\Campaigns\Campaigns
  • MailChimp\Campaigns\Content
  • MailChimp\Campaigns\Feedback
  • MailChimp\Conversations\Conversations
  • MailChimp\Ecommerce\Carts
  • MailChimp\Ecommerce\Customers
  • MailChimp\Ecommerce\Ecommerce
  • MailChimp\Ecommerce\Orders
  • MailChimp\Ecommerce\Products
  • MailChimp\FileManager\Files
  • MailChimp\FileManager\Folders
  • MailChimp\Lists\Interests
  • MailChimp\Lists\Lists
  • MailChimp\Lists\Members
  • MailChimp\Lists\MergeFields
  • MailChimp\Lists\Segments
  • MailChimp\Lists\SignupForms
  • MailChimp\Lists\Webhooks
  • MailChimp\MailChimp
  • MailChimp\Reports\Reports
  • MailChimp\TemplateFolders\TemplateFolders
  • MailChimp\Templates\Templates
  1 <?php
  2 namespace MailChimp\Ecommerce;
  3 
  4 use MailChimp\MailChimp as MailChimp;
  5 use MailChimp\Ecommerce\Carts as Carts;
  6 use MailChimp\Ecommerce\Customers as Customers;
  7 use MailChimp\Ecommerce\Orders as Orders;
  8 use MailChimp\Ecommerce\Products as Products;
  9 
 10 class Ecommerce extends MailChimp
 11 {
 12 
 13     /**
 14      * Get a list of ecommerce stores for the account
 15      *
 16      * @param  array (optional)  $query
 17      * @return object
 18      */
 19     public function getStores(array $query = [] )
 20     {
 21         return self::execute("GET", "ecommerce/stores", $query);
 22     }
 23 
 24     /**
 25      * Get a list of ecommerce stores for the account
 26      *
 27      * @param string $store_id
 28      * @param array (optional) $query
 29      * @return object
 30      */
 31     public function getStore($store_id, array $query = [] )
 32     {
 33         return self::execute("GET", "ecommerce/stores/{$store_id}", $query);
 34     }
 35 
 36     /**
 37      * Add a new store
 38      *
 39      * @param string $store_id
 40      * @param string $list_id
 41      * @param string $name
 42      * @param string $currency_code The three-letter ISO 4217 code for the currency that the store accepts.
 43      * @param array (optional) $optional_settings
 44      * @return object
 45      */
 46     public function addStore($store_id, $list_id, $name, $currency_code, array $optional_settings = null)
 47     {
 48         $optional_fields = ["platform", "domain", "email_address", "money_format", "primary_locale", "timezone", "phone", "address"];
 49 
 50         $data = [
 51             "id" => $store_id,
 52             "list_id" => $list_id,
 53             "name" => $name,
 54             "currency_code" => $currency_code
 55         ];
 56 
 57         // If the optional fields are passed, process them against the list of optional fields.
 58         if (isset($optional_settings)) {
 59             $data = array_merge($data, self::optionalFields($optional_fields, $optional_settings));
 60         }
 61         return self::execute("POST", "ecommerce/stores", $data);
 62     }
 63 
 64     /**
 65      * Update a store
 66      *
 67      * @param string $store_id
 68      * @param array $data
 69      */
 70     public function updateStore($store_id, array $data = [])
 71     {
 72         return self::execute("PATCH", "ecommerce/stores/{$store_id}", $data);
 73     }
 74 
 75     /**
 76      * Delete a store
 77      *
 78      * @param string $string_id
 79      */
 80     public function deleteStore($store_id)
 81     {
 82         return self::execute("DELETE", "ecommerce/stores/{$store_id}");
 83     }
 84 
 85     /**
 86      *  Ecommerce subresources
 87      */
 88 
 89      /**
 90       * Instantiate Ecommerce Cart subresources
 91       *
 92       */
 93      public function carts()
 94      {
 95          return new Carts;
 96      }
 97 
 98      /**
 99       * Instantiate Ecommerce Customer subresources
100       *
101       */
102      public function customers()
103     {
104         return new Customers;
105     }
106 
107     /**
108      * Instantiate Ecommerce Orders subresources
109      *
110      */
111     public function orders()
112     {
113         return new Orders;
114     }
115 
116     /**
117      * Instantiate Ecommerce Products subresources
118      *
119      */
120     public function products()
121     {
122         return new Products;
123     }
124 
125 }
126 
API documentation generated by ApiGen