MailChimp for WooCommerce - Version 1.0.8

Version Description

  • add landing_site, financial status and discount information for orders
  • fix to support php 5.3
Download this release

Release Info

Developer MailChimp
Plugin Icon wp plugin MailChimp for WooCommerce
Version 1.0.8
Comparing to
See all releases

Code changes from version 1.0.7 to 1.0.8

README.txt CHANGED
@@ -45,4 +45,88 @@ You’ll need to do a few things to connect your WooCommerce store to MailChimp.
45
  - Connect the plugin with your MailChimp API Key.
46
  - Configure your list settings to complete the data sync process.
47
 
48
- For more information on settings and configuration, please visit our Knowledge Base: [http://kb.mailchimp.com/integrations/e-commerce/connect-or-disconnect-mailchimp-for-woocommerce](http://kb.mailchimp.com/integrations/e-commerce/connect-or-disconnect-mailchimp-for-woocommerce)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  - Connect the plugin with your MailChimp API Key.
46
  - Configure your list settings to complete the data sync process.
47
 
48
+ For more information on settings and configuration, please visit our Knowledge Base: [http://kb.mailchimp.com/integrations/e-commerce/connect-or-disconnect-mailchimp-for-woocommerce](http://kb.mailchimp.com/integrations/e-commerce/connect-or-disconnect-mailchimp-for-woocommerce)
49
+
50
+ == Changelog ==
51
+ = 1.0.8 =
52
+ * add landing_site, financial status and discount information for orders
53
+ * fix to support php 5.3
54
+
55
+ = 1.0.7 =
56
+ * add options to move, hide and change defaults for opt-in checkbox
57
+ * add ability to re-sync and display connection details
58
+ * support for subscriptions without orders
59
+ * additional small fixes and some internal logging removal
60
+
61
+ = 1.0.6 =
62
+ * fixed conflict with the plugin updater where the class could not be loaded correctly.
63
+ * fixed error validation for store name.
64
+ * fixed cross device abandoned cart url's
65
+
66
+ = 1.0.4 =
67
+ * fix for Abandoned Carts without cookies
68
+
69
+ = 1.0.3 =
70
+ * fixed cart posts on dollar amounts greater than 1000
71
+
72
+ = 1.0.2 =
73
+ * title correction for Product Variants
74
+ * added installation checks for WooCommerce and phone contact info
75
+ * support for free orders
76
+
77
+ = 1.0 =
78
+ * added is_synicng flag to prevent sends during backfill
79
+ * fix for conflicts with Gravity Forms Pro and installation issues
80
+ * skip all Amazon orders
81
+ * allow users to set opt-in for pre-existing customers during first sync
82
+ * add Plugin Updater
83
+
84
+ = 0.1.22 =
85
+ * flag quantity as 1 if the product does not manage inventory
86
+
87
+ = 0.1.21 =
88
+ * php version check to display warnings < 5.5
89
+
90
+ = 0.1.19 =
91
+ * fix campaign tracking on new orders
92
+
93
+ = 0.1.18 =
94
+ * check woocommerce dependency before activating the plugin
95
+
96
+ = 0.1.17 =
97
+ * fix php version syntax errors for array's
98
+
99
+ = 0.1.16 =
100
+ * fix namespace conflicts
101
+ * fix free order 0.00 issue
102
+ * fix product variant naming issue
103
+
104
+ = 0.1.15 =
105
+ * adding special MailChimp header to requests
106
+
107
+ = 0.1.14 =
108
+ * removing jquery dependencies
109
+
110
+ = 0.1.13 =
111
+ * fixing a number format issue on total_spent
112
+
113
+ = 0.1.12 =
114
+ * skipping orders placed through amazon due to seller agreements
115
+
116
+ = 0.1.11 =
117
+ * removed an extra debug log that was not needed
118
+
119
+ = 0.1.10 =
120
+ * altered debug logging and fixed store settings validation requirements
121
+
122
+ = 0.1.9 =
123
+ * using fallback to stream context during failed patch requests
124
+
125
+ = 0.1.8 =
126
+ * fixing http request header for larger patch requests
127
+
128
+ = 0.1.7 =
129
+ * fixing various bugs with the sync and product issues.
130
+
131
+ = 0.1.2 =
132
+ * fixed admin order update hook.
admin/partials/tabs/newsletter_settings.php CHANGED
@@ -50,8 +50,9 @@ $list_is_configured = isset($options['mailchimp_list']) && (!empty($options['mai
50
 
51
  <?php
52
  if (is_array($mailchimp_lists)) {
 
53
  foreach ($mailchimp_lists as $key => $value ) {
54
- echo '<option value="' . esc_attr( $key ) . '" ' . selected( $key === $options['mailchimp_list'], true, false ) . '>' . esc_html( $value ) . '</option>';
55
  }
56
  }
57
  ?>
50
 
51
  <?php
52
  if (is_array($mailchimp_lists)) {
53
+ $selected_list = isset($options['mailchimp_list']) ? $options['mailchimp_list'] : null;
54
  foreach ($mailchimp_lists as $key => $value ) {
55
+ echo '<option value="' . esc_attr( $key ) . '" ' . selected(((string) $key === (string) $selected_list), true, false) . '>' . esc_html( $value ) . '</option>';
56
  }
57
  }
58
  ?>
changelog.md CHANGED
@@ -1,11 +1,36 @@
 
 
 
 
 
 
 
 
 
 
1
  ** 1.0.6 **
2
  * fixed conflict with the plugin updater where the class could not be loaded correctly.
3
  * fixed error validation for store name.
4
  * fixed cross device abandoned cart url's
5
 
 
 
 
6
  ** 1.0.3 **
7
  * fixed cart posts on dollar amounts greater than 1000
8
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  ** 0.1.22 **
10
  * flag quantity as 1 if the product does not manage inventory
11
 
1
+ ** 1.0.8 **
2
+ * add landing_site, financial status and discount information for orders
3
+ * fix to support php 5.3
4
+
5
+ ** 1.0.7 **
6
+ * add options to move, hide and change defaults for opt-in checkbox
7
+ * add ability to re-sync and display connection details
8
+ * support for subscriptions without orders
9
+ * additional small fixes and some internal logging removal
10
+
11
  ** 1.0.6 **
12
  * fixed conflict with the plugin updater where the class could not be loaded correctly.
13
  * fixed error validation for store name.
14
  * fixed cross device abandoned cart url's
15
 
16
+ ** 1.0.4 **
17
+ * fix for Abandoned Carts without cookies
18
+
19
  ** 1.0.3 **
20
  * fixed cart posts on dollar amounts greater than 1000
21
 
22
+ ** 1.0.2**
23
+ * title correction for Product Variants
24
+ * added installation checks for WooCommerce and phone contact info
25
+ support for free orders
26
+
27
+ ** 1.0 **
28
+ * added is_synicng flag to prevent sends during backfill
29
+ * fix for conflicts with Gravity Forms Pro and installation issues
30
+ * skip all Amazon orders
31
+ * allow users to set opt-in for pre-existing customers during first sync
32
+ * add Plugin Updater
33
+
34
  ** 0.1.22 **
35
  * flag quantity as 1 if the product does not manage inventory
36
 
includes/api/assets/class-mailchimp-cart.php CHANGED
@@ -261,12 +261,14 @@ class MailChimp_WooCommerce_Cart
261
  }
262
 
263
  if (array_key_exists('customer', $data) && is_array($data['customer'])) {
264
- $this->customer = (new MailChimp_WooCommerce_Customer())->fromArray($data['customer']);
 
265
  }
266
 
267
  if (array_key_exists('lines', $data) && is_array($data['lines'])) {
268
  foreach ($data['lines'] as $line_item) {
269
- $this->lines[] = (new MailChimp_WooCommerce_LineItem)->fromArray($line_item);
 
270
  }
271
  }
272
 
261
  }
262
 
263
  if (array_key_exists('customer', $data) && is_array($data['customer'])) {
264
+ $customer = new MailChimp_WooCommerce_Customer();
265
+ $this->customer = $customer->fromArray($data['customer']);
266
  }
267
 
268
  if (array_key_exists('lines', $data) && is_array($data['lines'])) {
269
  foreach ($data['lines'] as $line_item) {
270
+ $item = new MailChimp_WooCommerce_LineItem();
271
+ $this->lines[] = $item->fromArray($line_item);
272
  }
273
  }
274
 
includes/api/assets/class-mailchimp-customer.php CHANGED
@@ -249,7 +249,8 @@ class MailChimp_WooCommerce_Customer
249
  }
250
 
251
  if (array_key_exists('address', $data) && is_array($data['address'])) {
252
- $this->address = (new MailChimp_WooCommerce_Address())->fromArray($data['address']);
 
253
  }
254
 
255
  return $this;
249
  }
250
 
251
  if (array_key_exists('address', $data) && is_array($data['address'])) {
252
+ $address = new MailChimp_WooCommerce_Address();
253
+ $this->address = $address->fromArray($data['address']);
254
  }
255
 
256
  return $this;
includes/api/assets/class-mailchimp-order.php CHANGED
@@ -11,6 +11,7 @@
11
  class MailChimp_WooCommerce_Order
12
  {
13
  protected $id = null;
 
14
  protected $customer = null;
15
  protected $campaign_id = null;
16
  protected $financial_status = null;
@@ -18,6 +19,7 @@ class MailChimp_WooCommerce_Order
18
  protected $currency_code = null;
19
  protected $order_total = null;
20
  protected $tax_total = null;
 
21
  protected $shipping_total = null;
22
  protected $updated_at_foreign = null;
23
  protected $processed_at_foreign = null;
@@ -33,6 +35,7 @@ class MailChimp_WooCommerce_Order
33
  {
34
  return array(
35
  'id' => 'required|string',
 
36
  'customer' => 'required',
37
  'campaign_id' => 'string',
38
  'financial_status' => 'string',
@@ -40,6 +43,7 @@ class MailChimp_WooCommerce_Order
40
  'currency_code' => 'required|currency_code',
41
  'order_total' => 'required|numeric',
42
  'tax_total' => 'numeric',
 
43
  'processed_at_foreign' => 'date',
44
  'updated_at_foreign' => 'date',
45
  'cancelled_at_foreign' => 'date',
@@ -66,6 +70,25 @@ class MailChimp_WooCommerce_Order
66
  return $this->id;
67
  }
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  /**
70
  * @param MailChimp_WooCommerce_Customer $customer
71
  * @return MailChimp_WooCommerce_Order
@@ -239,6 +262,25 @@ class MailChimp_WooCommerce_Order
239
  return $this;
240
  }
241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  /**
243
  * @param \DateTime $time
244
  * @return $this
@@ -347,6 +389,7 @@ class MailChimp_WooCommerce_Order
347
  {
348
  return mailchimp_array_remove_empty(array(
349
  'id' => (string) $this->getId(),
 
350
  'customer' => $this->getCustomer()->toArray(),
351
  'campaign_id' => (string) $this->getCampaignId(),
352
  'financial_status' => (string) $this->getFinancialStatus(),
@@ -354,6 +397,7 @@ class MailChimp_WooCommerce_Order
354
  'currency_code' => (string) $this->getCurrencyCode(),
355
  'order_total' => floatval($this->getOrderTotal()),
356
  'tax_total' => floatval($this->getTaxTotal()),
 
357
  'shipping_total' => floatval($this->getShippingTotal()),
358
  'processed_at_foreign' => (string) $this->getProcessedAt(),
359
  'cancelled_at_foreign' => (string) $this->getCancelledAt(),
@@ -374,8 +418,8 @@ class MailChimp_WooCommerce_Order
374
  public function fromArray(array $data)
375
  {
376
  $singles = array(
377
- 'id', 'campaign_id', 'financial_status', 'fulfillment_status',
378
- 'currency_code', 'order_total', 'tax_total', 'processed_at_foreign',
379
  'cancelled_at_foreign', 'updated_at_foreign'
380
  );
381
 
@@ -386,17 +430,20 @@ class MailChimp_WooCommerce_Order
386
  }
387
 
388
  if (array_key_exists('shipping_address', $data) && is_array($data['shipping_address'])) {
389
- $this->shipping_address = (new MailChimp_WooCommerce_Address())->fromArray($data['shipping_address']);
 
390
  }
391
 
392
  if (array_key_exists('billing_address', $data) && is_array($data['billing_address'])) {
393
- $this->billing_address = (new MailChimp_WooCommerce_Address())->fromArray($data['billing_address']);
 
394
  }
395
 
396
  if (array_key_exists('lines', $data) && is_array($data['lines'])) {
397
  $this->lines = array();
398
  foreach ($data['lines'] as $line_item) {
399
- $this->lines[] = (new MailChimp_WooCommerce_LineItem())->fromArray($line_item);
 
400
  }
401
  }
402
 
11
  class MailChimp_WooCommerce_Order
12
  {
13
  protected $id = null;
14
+ protected $landing_site = null;
15
  protected $customer = null;
16
  protected $campaign_id = null;
17
  protected $financial_status = null;
19
  protected $currency_code = null;
20
  protected $order_total = null;
21
  protected $tax_total = null;
22
+ protected $discount_total = null;
23
  protected $shipping_total = null;
24
  protected $updated_at_foreign = null;
25
  protected $processed_at_foreign = null;
35
  {
36
  return array(
37
  'id' => 'required|string',
38
+ 'landing_site' => 'required|string',
39
  'customer' => 'required',
40
  'campaign_id' => 'string',
41
  'financial_status' => 'string',
43
  'currency_code' => 'required|currency_code',
44
  'order_total' => 'required|numeric',
45
  'tax_total' => 'numeric',
46
+ 'discount_total' => 'numeric',
47
  'processed_at_foreign' => 'date',
48
  'updated_at_foreign' => 'date',
49
  'cancelled_at_foreign' => 'date',
70
  return $this->id;
71
  }
72
 
73
+ /**
74
+ * @param $landing_site
75
+ * @return $this
76
+ */
77
+ public function setLandingSite($landing_site)
78
+ {
79
+ $this->landing_site = $landing_site;
80
+
81
+ return $this;
82
+ }
83
+
84
+ /**
85
+ * @return null|string
86
+ */
87
+ public function getLandingSite()
88
+ {
89
+ return $this->landing_site;
90
+ }
91
+
92
  /**
93
  * @param MailChimp_WooCommerce_Customer $customer
94
  * @return MailChimp_WooCommerce_Order
262
  return $this;
263
  }
264
 
265
+ /**
266
+ * @return mixed
267
+ */
268
+ public function getDiscountTotal()
269
+ {
270
+ return $this->discount_total;
271
+ }
272
+
273
+ /**
274
+ * @param mixed $discount_total
275
+ * @return MailChimp_WooCommerce_Order
276
+ */
277
+ public function setDiscountTotal($discount_total)
278
+ {
279
+ $this->discount_total = $discount_total;
280
+
281
+ return $this;
282
+ }
283
+
284
  /**
285
  * @param \DateTime $time
286
  * @return $this
389
  {
390
  return mailchimp_array_remove_empty(array(
391
  'id' => (string) $this->getId(),
392
+ 'landing_site' => (string) $this->getLandingSite(),
393
  'customer' => $this->getCustomer()->toArray(),
394
  'campaign_id' => (string) $this->getCampaignId(),
395
  'financial_status' => (string) $this->getFinancialStatus(),
397
  'currency_code' => (string) $this->getCurrencyCode(),
398
  'order_total' => floatval($this->getOrderTotal()),
399
  'tax_total' => floatval($this->getTaxTotal()),
400
+ 'discount_total' => floatval($this->getDiscountTotal()),
401
  'shipping_total' => floatval($this->getShippingTotal()),
402
  'processed_at_foreign' => (string) $this->getProcessedAt(),
403
  'cancelled_at_foreign' => (string) $this->getCancelledAt(),
418
  public function fromArray(array $data)
419
  {
420
  $singles = array(
421
+ 'id', 'landing_site', 'campaign_id', 'financial_status', 'fulfillment_status',
422
+ 'currency_code', 'order_total', 'tax_total', 'discount_total', 'processed_at_foreign',
423
  'cancelled_at_foreign', 'updated_at_foreign'
424
  );
425
 
430
  }
431
 
432
  if (array_key_exists('shipping_address', $data) && is_array($data['shipping_address'])) {
433
+ $shipping = new MailChimp_WooCommerce_Address();
434
+ $this->shipping_address = $shipping->fromArray($data['shipping_address']);
435
  }
436
 
437
  if (array_key_exists('billing_address', $data) && is_array($data['billing_address'])) {
438
+ $billing = new MailChimp_WooCommerce_Address();
439
+ $this->billing_address = $billing->fromArray($data['billing_address']);
440
  }
441
 
442
  if (array_key_exists('lines', $data) && is_array($data['lines'])) {
443
  $this->lines = array();
444
  foreach ($data['lines'] as $line_item) {
445
+ $item = new MailChimp_WooCommerce_LineItem();
446
+ $this->lines[] = $item->fromArray($line_item);
447
  }
448
  }
449
 
includes/api/assets/class-mailchimp-product.php CHANGED
@@ -272,7 +272,8 @@ class MailChimp_WooCommerce_Product
272
  if (array_key_exists('variants', $data) && is_array($data['variants'])) {
273
  $this->variants = array();
274
  foreach ($data['variants'] as $variant) {
275
- $this->variants[] = (new MailChimp_WooCommerce_ProductVariation())->fromArray($variant);
 
276
  }
277
  }
278
 
272
  if (array_key_exists('variants', $data) && is_array($data['variants'])) {
273
  $this->variants = array();
274
  foreach ($data['variants'] as $variant) {
275
+ $variation = new MailChimp_WooCommerce_ProductVariation();
276
+ $this->variants[] = $variation->fromArray($variant);
277
  }
278
  }
279
 
includes/api/assets/class-mailchimp-store.php CHANGED
@@ -333,7 +333,8 @@ class MailChimp_WooCommerce_Store
333
  }
334
 
335
  if (array_key_exists('address', $data)) {
336
- $this->address = (new MailChimp_WooCommerce_Address())->fromArray($data['address']);
 
337
  }
338
 
339
  return $this;
333
  }
334
 
335
  if (array_key_exists('address', $data)) {
336
+ $address = new MailChimp_WooCommerce_Address();
337
+ $this->address = $address->fromArray($data['address']);
338
  }
339
 
340
  return $this;
includes/api/class-mailchimp-api.php CHANGED
@@ -389,7 +389,8 @@ class MailChimp_WooCommerce_MailChimpApi
389
  if (!isset($data['id']) || !isset($data['name'])) {
390
  return false;
391
  }
392
- return (new MailChimp_WooCommerce_Store)->fromArray($data);
 
393
  } catch (MailChimp_WooCommerce_Error $e) {
394
  return false;
395
  }
@@ -410,7 +411,8 @@ class MailChimp_WooCommerce_MailChimpApi
410
  $response = array();
411
 
412
  foreach ($data['stores'] as $store_data) {
413
- $response[] = (new MailChimp_WooCommerce_Store)->fromArray($store_data);
 
414
  }
415
 
416
  return $response;
@@ -455,7 +457,8 @@ class MailChimp_WooCommerce_MailChimpApi
455
  try {
456
  $this->validateStoreSubmission($store);
457
  $data = $this->post("ecommerce/stores", $store->toArray());
458
- return (new MailChimp_WooCommerce_Store)->fromArray($data);
 
459
  } catch (\Exception $e) {
460
  if (!$silent) throw $e;
461
  return false;
@@ -473,7 +476,8 @@ class MailChimp_WooCommerce_MailChimpApi
473
  try {
474
  $this->validateStoreSubmission($store);
475
  $data = $this->patch("ecommerce/stores/{$store->getId()}", $store->toArray());
476
- return (new MailChimp_WooCommerce_Store)->fromArray($data);
 
477
  } catch (\Exception $e) {
478
  if (!$silent) throw $e;
479
  return false;
@@ -503,7 +507,8 @@ class MailChimp_WooCommerce_MailChimpApi
503
  {
504
  try {
505
  $data = $this->get("ecommerce/stores/$store_id/customers/$customer_id");
506
- return (new MailChimp_WooCommerce_Customer)->fromArray($data);
 
507
  } catch (MailChimp_WooCommerce_Error $e) {
508
  return false;
509
  }
@@ -518,7 +523,8 @@ class MailChimp_WooCommerce_MailChimpApi
518
  {
519
  $this->validateStoreSubmission($store);
520
  $data = $this->post("ecommerce/stores", $store->toArray());
521
- return (new MailChimp_WooCommerce_Customer)->fromArray($data);
 
522
  }
523
 
524
  /**
@@ -549,7 +555,8 @@ class MailChimp_WooCommerce_MailChimpApi
549
  {
550
  try {
551
  $data = $this->post("ecommerce/stores/$store_id/carts", $cart->toArray());
552
- return (new MailChimp_WooCommerce_Cart)->setStoreID($store_id)->fromArray($data);
 
553
  } catch (MailChimp_WooCommerce_Error $e) {
554
  if (!$silent) throw $e;
555
  mailchimp_log('api.addCart', $e->getMessage());
@@ -568,7 +575,8 @@ class MailChimp_WooCommerce_MailChimpApi
568
  {
569
  try {
570
  $data = $this->patch("ecommerce/stores/$store_id/carts/{$cart->getId()}", $cart->toArrayForUpdate());
571
- return (new MailChimp_WooCommerce_Cart)->setStoreID($store_id)->fromArray($data);
 
572
  } catch (MailChimp_WooCommerce_Error $e) {
573
  if (!$silent) throw $e;
574
  mailchimp_log('api.updateCart', $e->getMessage());
@@ -585,7 +593,8 @@ class MailChimp_WooCommerce_MailChimpApi
585
  {
586
  try {
587
  $data = $this->get("ecommerce/stores/$store_id/carts/$id");
588
- return (new MailChimp_WooCommerce_Cart)->setStoreID($store_id)->fromArray($data);
 
589
  } catch (MailChimp_WooCommerce_Error $e) {
590
  return false;
591
  }
@@ -618,7 +627,8 @@ class MailChimp_WooCommerce_MailChimpApi
618
  try {
619
  $this->validateStoreSubmission($customer);
620
  $data = $this->patch("ecommerce/stores/$store_id/customers/{$customer->getId()}", $customer->toArray());
621
- return (new MailChimp_WooCommerce_Customer)->fromArray($data);
 
622
  } catch (MailChimp_WooCommerce_Error $e) {
623
  if (!$silent) throw $e;
624
  return false;
@@ -655,7 +665,8 @@ class MailChimp_WooCommerce_MailChimpApi
655
  }
656
  $data = $this->post("ecommerce/stores/$store_id/orders", $order->toArray());
657
  update_option('mailchimp-woocommerce-resource-last-updated', time());
658
- return (new MailChimp_WooCommerce_Order)->fromArray($data);
 
659
  } catch (\Exception $e) {
660
  if (!$silent) throw $e;
661
  mailchimp_log('api.add_order.error', $e->getMessage(), array('submission' => $order->toArray()));
@@ -678,7 +689,8 @@ class MailChimp_WooCommerce_MailChimpApi
678
  }
679
  $id = $order->getId();
680
  $data = $this->patch("ecommerce/stores/$store_id/orders/$id", $order->toArray());
681
- return (new MailChimp_WooCommerce_Order)->fromArray($data);
 
682
  } catch (\Exception $e) {
683
  if (!$silent) throw $e;
684
  mailchimp_log('api.update_order.error', $e->getMessage(), array('submission' => $order->toArray()));
@@ -695,7 +707,8 @@ class MailChimp_WooCommerce_MailChimpApi
695
  {
696
  try {
697
  $data = $this->get("ecommerce/stores/$store_id/orders/$order_id");
698
- return (new MailChimp_WooCommerce_Order)->fromArray($data);
 
699
  } catch (MailChimp_WooCommerce_Error $e) {
700
  return false;
701
  }
@@ -725,7 +738,8 @@ class MailChimp_WooCommerce_MailChimpApi
725
  {
726
  try {
727
  $data = $this->get("ecommerce/stores/$store_id/products/$product_id");
728
- return (new MailChimp_WooCommerce_Product)->fromArray($data);
 
729
  } catch (MailChimp_WooCommerce_Error $e) {
730
  return false;
731
  }
@@ -761,7 +775,8 @@ class MailChimp_WooCommerce_MailChimpApi
761
  $this->validateStoreSubmission($product);
762
  $data = $this->post("ecommerce/stores/$store_id/products", $product->toArray());
763
  update_option('mailchimp-woocommerce-resource-last-updated', time());
764
- return (new MailChimp_WooCommerce_Product)->fromArray($data);
 
765
  } catch (\Exception $e) {
766
  if (!$silent) throw $e;
767
  mailchimp_log('api.add_product.error', $e->getMessage(), array('submission' => $product->toArray()));
389
  if (!isset($data['id']) || !isset($data['name'])) {
390
  return false;
391
  }
392
+ $store = new MailChimp_WooCommerce_Store();
393
+ return $store->fromArray($data);
394
  } catch (MailChimp_WooCommerce_Error $e) {
395
  return false;
396
  }
411
  $response = array();
412
 
413
  foreach ($data['stores'] as $store_data) {
414
+ $store = new MailChimp_WooCommerce_Store();
415
+ $response[] = $store->fromArray($store_data);
416
  }
417
 
418
  return $response;
457
  try {
458
  $this->validateStoreSubmission($store);
459
  $data = $this->post("ecommerce/stores", $store->toArray());
460
+ $store = new MailChimp_WooCommerce_Store();
461
+ return $store->fromArray($data);
462
  } catch (\Exception $e) {
463
  if (!$silent) throw $e;
464
  return false;
476
  try {
477
  $this->validateStoreSubmission($store);
478
  $data = $this->patch("ecommerce/stores/{$store->getId()}", $store->toArray());
479
+ $store = new MailChimp_WooCommerce_Store();
480
+ return $store->fromArray($data);
481
  } catch (\Exception $e) {
482
  if (!$silent) throw $e;
483
  return false;
507
  {
508
  try {
509
  $data = $this->get("ecommerce/stores/$store_id/customers/$customer_id");
510
+ $customer = new MailChimp_WooCommerce_Customer();
511
+ return $customer->fromArray($data);
512
  } catch (MailChimp_WooCommerce_Error $e) {
513
  return false;
514
  }
523
  {
524
  $this->validateStoreSubmission($store);
525
  $data = $this->post("ecommerce/stores", $store->toArray());
526
+ $customer = new MailChimp_WooCommerce_Customer();
527
+ return $customer->fromArray($data);
528
  }
529
 
530
  /**
555
  {
556
  try {
557
  $data = $this->post("ecommerce/stores/$store_id/carts", $cart->toArray());
558
+ $cart = new MailChimp_WooCommerce_Cart();
559
+ return $cart->setStoreID($store_id)->fromArray($data);
560
  } catch (MailChimp_WooCommerce_Error $e) {
561
  if (!$silent) throw $e;
562
  mailchimp_log('api.addCart', $e->getMessage());
575
  {
576
  try {
577
  $data = $this->patch("ecommerce/stores/$store_id/carts/{$cart->getId()}", $cart->toArrayForUpdate());
578
+ $cart = new MailChimp_WooCommerce_Cart();
579
+ return $cart->setStoreID($store_id)->fromArray($data);
580
  } catch (MailChimp_WooCommerce_Error $e) {
581
  if (!$silent) throw $e;
582
  mailchimp_log('api.updateCart', $e->getMessage());
593
  {
594
  try {
595
  $data = $this->get("ecommerce/stores/$store_id/carts/$id");
596
+ $cart = new MailChimp_WooCommerce_Cart();
597
+ return $cart->setStoreID($store_id)->fromArray($data);
598
  } catch (MailChimp_WooCommerce_Error $e) {
599
  return false;
600
  }
627
  try {
628
  $this->validateStoreSubmission($customer);
629
  $data = $this->patch("ecommerce/stores/$store_id/customers/{$customer->getId()}", $customer->toArray());
630
+ $customer = new MailChimp_WooCommerce_Customer();
631
+ return $customer->fromArray($data);
632
  } catch (MailChimp_WooCommerce_Error $e) {
633
  if (!$silent) throw $e;
634
  return false;
665
  }
666
  $data = $this->post("ecommerce/stores/$store_id/orders", $order->toArray());
667
  update_option('mailchimp-woocommerce-resource-last-updated', time());
668
+ $order = new MailChimp_WooCommerce_Order();
669
+ return $order->fromArray($data);
670
  } catch (\Exception $e) {
671
  if (!$silent) throw $e;
672
  mailchimp_log('api.add_order.error', $e->getMessage(), array('submission' => $order->toArray()));
689
  }
690
  $id = $order->getId();
691
  $data = $this->patch("ecommerce/stores/$store_id/orders/$id", $order->toArray());
692
+ $order = new MailChimp_WooCommerce_Order();
693
+ return $order->fromArray($data);
694
  } catch (\Exception $e) {
695
  if (!$silent) throw $e;
696
  mailchimp_log('api.update_order.error', $e->getMessage(), array('submission' => $order->toArray()));
707
  {
708
  try {
709
  $data = $this->get("ecommerce/stores/$store_id/orders/$order_id");
710
+ $order = new MailChimp_WooCommerce_Order();
711
+ return $order->fromArray($data);
712
  } catch (MailChimp_WooCommerce_Error $e) {
713
  return false;
714
  }
738
  {
739
  try {
740
  $data = $this->get("ecommerce/stores/$store_id/products/$product_id");
741
+ $product = new MailChimp_WooCommerce_Product();
742
+ return $product->fromArray($data);
743
  } catch (MailChimp_WooCommerce_Error $e) {
744
  return false;
745
  }
775
  $this->validateStoreSubmission($product);
776
  $data = $this->post("ecommerce/stores/$store_id/products", $product->toArray());
777
  update_option('mailchimp-woocommerce-resource-last-updated', time());
778
+ $product = new MailChimp_WooCommerce_Product();
779
+ return $product->fromArray($data);
780
  } catch (\Exception $e) {
781
  if (!$silent) throw $e;
782
  mailchimp_log('api.add_product.error', $e->getMessage(), array('submission' => $product->toArray()));
includes/api/class-mailchimp-woocommerce-transform-orders.php CHANGED
@@ -65,16 +65,30 @@ class MailChimp_WooCommerce_Transform_Orders
65
  $order->setCampaignId($this->campaign_id);
66
  }
67
 
68
- $order->setFulfillmentStatus($woo->get_status());
69
  $order->setProcessedAt(mailchimp_date_utc($woo->order_date));
70
 
71
- if ($woo->get_status() === 'cancelled') {
72
- $order->setCancelledAt(mailchimp_date_utc($woo->modified_date));
73
- }
74
-
75
  $order->setCurrencyCode($woo->get_order_currency());
76
- $order->setFinancialStatus($woo->is_paid() ? 'paid' : 'pending');
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  $order->setOrderTotal($woo->get_total());
79
 
80
  // if we have any tax
@@ -83,6 +97,9 @@ class MailChimp_WooCommerce_Transform_Orders
83
  // if we have shipping.
84
  $order->setShippingTotal($woo->get_total_shipping());
85
 
 
 
 
86
  // set the customer
87
  $order->setCustomer($this->buildCustomerFromOrder($woo));
88
 
@@ -395,4 +412,50 @@ class MailChimp_WooCommerce_Transform_Orders
395
 
396
  return $address;
397
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
398
  }
65
  $order->setCampaignId($this->campaign_id);
66
  }
67
 
 
68
  $order->setProcessedAt(mailchimp_date_utc($woo->order_date));
69
 
 
 
 
 
70
  $order->setCurrencyCode($woo->get_order_currency());
 
71
 
72
+ // grab the current statuses - this will end up being custom at some point.
73
+ $statuses = $this->getOrderStatuses();
74
+
75
+ // grab the order status
76
+ $status = $woo->get_status();
77
+
78
+ // map the fulfillment and financial statuses based on the map above.
79
+ $fulfillment_status = array_key_exists($status, $statuses) ? $statuses[$status]->fulfillment : null;
80
+ $financial_status = array_key_exists($status, $statuses) ? $statuses[$status]->financial : $status;
81
+
82
+ // set the fulfillment_status
83
+ $order->setFulfillmentStatus($fulfillment_status);
84
+
85
+ // set the financial status
86
+ $order->setFinancialStatus($financial_status);
87
+
88
+ // only set this if the order is cancelled.
89
+ if ($status === 'cancelled') $order->setCancelledAt(mailchimp_date_utc($woo->modified_date));
90
+
91
+ // set the total
92
  $order->setOrderTotal($woo->get_total());
93
 
94
  // if we have any tax
97
  // if we have shipping.
98
  $order->setShippingTotal($woo->get_total_shipping());
99
 
100
+ // set the order discount
101
+ $order->setDiscountTotal($woo->get_total_discount());
102
+
103
  // set the customer
104
  $order->setCustomer($this->buildCustomerFromOrder($woo));
105
 
412
 
413
  return $address;
414
  }
415
+
416
+ /**
417
+ * @return array
418
+ */
419
+ public function getOrderStatuses()
420
+ {
421
+ return array(
422
+ // Order received (unpaid)
423
+ 'pending' => (object) array(
424
+ 'financial' => 'pending',
425
+ 'fulfillment' => null
426
+ ),
427
+ // Payment received and stock has been reduced – the order is awaiting fulfillment.
428
+ // All product orders require processing, except those for digital downloads
429
+ 'processing' => (object) array(
430
+ 'financial' => 'processing',
431
+ 'fulfillment' => null
432
+ ),
433
+ // Awaiting payment – stock is reduced, but you need to confirm payment
434
+ 'on-hold' => (object) array(
435
+ 'financial' => 'on-hold',
436
+ 'fulfillment' => null
437
+ ),
438
+ // Order fulfilled and complete – requires no further action
439
+ 'completed' => (object) array(
440
+ 'financial' => 'fulfilled',
441
+ 'fulfillment' => 'fulfilled'
442
+ ),
443
+ // Cancelled by an admin or the customer – no further action required
444
+ 'cancelled' => (object) array(
445
+ 'financial' => 'cancelled',
446
+ 'fulfillment' => null
447
+ ),
448
+ // Refunded by an admin – no further action required
449
+ 'refunded' => (object) array(
450
+ 'financial' => 'refunded',
451
+ 'fulfillment' => null
452
+ ),
453
+ // Payment failed or was declined (unpaid). Note that this status may not show immediately and
454
+ // instead show as Pending until verified (i.e., PayPal)
455
+ 'failed' => (object) array(
456
+ 'financial' => 'failed',
457
+ 'fulfillment' => null
458
+ ),
459
+ );
460
+ }
461
  }
includes/class-mailchimp-woocommerce-service.php CHANGED
@@ -10,10 +10,11 @@
10
  */
11
  class MailChimp_Service extends MailChimp_Woocommerce_Options
12
  {
 
 
13
  protected $user_email = null;
14
  protected $previous_email = null;
15
  protected $force_cart_post = false;
16
- protected $pushed_orders = array();
17
  protected $cart_was_submitted = false;
18
  protected $cart = array();
19
  protected $validated_cart_db = false;
@@ -54,26 +55,56 @@ class MailChimp_Service extends MailChimp_Woocommerce_Options
54
  }
55
 
56
  /**
 
 
57
  * @param $order_id
58
  */
59
- public function handleOrderStatusChanged($order_id)
60
  {
61
- if ($this->hasOption('mailchimp_api_key') && !array_key_exists($order_id, $this->pushed_orders)) {
62
 
63
  // register this order is already in process..
64
- $this->pushed_orders[$order_id] = true;
65
 
66
  // see if we have a session id and a campaign id, also only do this when this user is not the admin.
67
  $campaign_id = $this->getCampaignTrackingID();
68
 
 
 
 
 
 
 
 
 
 
 
 
69
  // queue up the single order to be processed.
70
- $handler = new MailChimp_WooCommerce_Single_Order($order_id, null, $campaign_id);
71
  wp_queue($handler);
72
  }
73
  }
74
 
75
  /**
76
- * @return bool|void
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  */
78
  public function handleCartUpdated()
79
  {
@@ -234,6 +265,9 @@ class MailChimp_Service extends MailChimp_Woocommerce_Options
234
  */
235
  public function handleCampaignTracking()
236
  {
 
 
 
237
  $cookie_duration = $this->getCookieDuration();
238
 
239
  // if we have a query string of the mc_cart_id in the URL, that means we are sending a campaign from MC
@@ -295,6 +329,60 @@ class MailChimp_Service extends MailChimp_Woocommerce_Options
295
  return $this;
296
  }
297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  /**
299
  * @return bool
300
  */
@@ -534,4 +622,5 @@ class MailChimp_Service extends MailChimp_Woocommerce_Options
534
  echo json_encode($data);
535
  exit;
536
  }
 
537
  }
10
  */
11
  class MailChimp_Service extends MailChimp_Woocommerce_Options
12
  {
13
+ protected static $pushed_orders = array();
14
+
15
  protected $user_email = null;
16
  protected $previous_email = null;
17
  protected $force_cart_post = false;
 
18
  protected $cart_was_submitted = false;
19
  protected $cart = array();
20
  protected $validated_cart_db = false;
55
  }
56
 
57
  /**
58
+ * This should only fire on a web based order so we can do real campaign tracking here.
59
+ *
60
  * @param $order_id
61
  */
62
+ public function onNewOrder($order_id)
63
  {
64
+ if ($this->hasOption('mailchimp_api_key')) {
65
 
66
  // register this order is already in process..
67
+ static::$pushed_orders[$order_id] = true;
68
 
69
  // see if we have a session id and a campaign id, also only do this when this user is not the admin.
70
  $campaign_id = $this->getCampaignTrackingID();
71
 
72
+ // grab the landing site cookie if we have one here.
73
+ $landing_site = $this->getLandingSiteCookie();
74
+
75
+ // expire the landing site cookie so we can rinse and repeat tracking
76
+ $this->expireLandingSiteCookie();
77
+
78
+ mailchimp_log('new_order', "New order #$order_id", array(
79
+ 'campaign_id' => $campaign_id,
80
+ 'landing_site' => $landing_site,
81
+ ));
82
+
83
  // queue up the single order to be processed.
84
+ $handler = new MailChimp_WooCommerce_Single_Order($order_id, null, $campaign_id, $landing_site);
85
  wp_queue($handler);
86
  }
87
  }
88
 
89
  /**
90
+ * @param $order_id
91
+ */
92
+ public function handleOrderStatusChanged($order_id)
93
+ {
94
+ if ($this->hasOption('mailchimp_api_key')) {
95
+
96
+ // register this order is already in process..
97
+ static::$pushed_orders[$order_id] = true;
98
+
99
+ // queue up the single order to be processed.
100
+ $handler = new MailChimp_WooCommerce_Single_Order($order_id, null, null, null);
101
+ $handler->is_update = true;
102
+ wp_queue($handler);
103
+ }
104
+ }
105
+
106
+ /**
107
+ * @return bool
108
  */
109
  public function handleCartUpdated()
110
  {
265
  */
266
  public function handleCampaignTracking()
267
  {
268
+ // set the landing site cookie if we don't have one.
269
+ $this->setLandingSiteCookie();
270
+
271
  $cookie_duration = $this->getCookieDuration();
272
 
273
  // if we have a query string of the mc_cart_id in the URL, that means we are sending a campaign from MC
329
  return $this;
330
  }
331
 
332
+ /**
333
+ * @return mixed|null
334
+ */
335
+ public function getLandingSiteCookie()
336
+ {
337
+ $cookie = $this->cookie('mailchimp_landing_site', false);
338
+
339
+ if (empty($cookie)) {
340
+ $cookie = $this->getWooSession('mailchimp_landing_site', false);
341
+ }
342
+
343
+ return $cookie;
344
+ }
345
+
346
+ /**
347
+ * @return $this
348
+ */
349
+ public function setLandingSiteCookie()
350
+ {
351
+ if (isset($_GET['expire_landing_site'])) $this->expireLandingSiteCookie();
352
+
353
+ // if we already have a cookie here, we need to skip it.
354
+ if ($this->getLandingSiteCookie() != false) return $this;
355
+
356
+ if (($http_referer = wp_get_raw_referer()) && !empty($http_referer)) {
357
+
358
+ // grab the current landing url since it's a referral.
359
+ $landing_site = home_url() . wp_unslash($_SERVER['REQUEST_URI']);
360
+
361
+ $compare_refer = str_replace(array('http://', 'https://'), '', $http_referer);
362
+ $compare_local = str_replace(array('http://', 'https://'), '', $landing_site);
363
+
364
+ if (strpos($compare_local, $compare_refer) === 0) return $this;
365
+
366
+ // set the cookie
367
+ @setcookie('mailchimp_landing_site', $landing_site, $this->getCookieDuration(), '/' );
368
+
369
+ $this->setWooSession('mailchimp_landing_site', $landing_site);
370
+ }
371
+
372
+ return $this;
373
+ }
374
+
375
+ /**
376
+ * @return $this
377
+ */
378
+ public function expireLandingSiteCookie()
379
+ {
380
+ @setcookie('mailchimp_landing_site', false, $this->getCookieDuration(), '/' );
381
+ $this->setWooSession('mailchimp_landing_site', false);
382
+
383
+ return $this;
384
+ }
385
+
386
  /**
387
  * @return bool
388
  */
622
  echo json_encode($data);
623
  exit;
624
  }
625
+
626
  }
includes/class-mailchimp-woocommerce.php CHANGED
@@ -325,9 +325,9 @@ class MailChimp_Woocommerce {
325
  $this->loader->add_action( 'init', $service, 'handleCampaignTracking' );
326
 
327
  // order hooks
328
- $this->loader->add_action('woocommerce_api_create_order', $service, 'handleOrderStatusChanged');
329
- $this->loader->add_action('woocommerce_thankyou', $service, 'handleOrderStatusChanged');
330
- $this->loader->add_action('woocommerce_order_status_changed', $service, 'handleOrderStatusChanged');
331
 
332
  // cart hooks
333
  $this->loader->add_action('woocommerce_cart_updated', $service, 'handleCartUpdated');
@@ -389,5 +389,4 @@ class MailChimp_Woocommerce {
389
  public function get_version() {
390
  return $this->version;
391
  }
392
-
393
  }
325
  $this->loader->add_action( 'init', $service, 'handleCampaignTracking' );
326
 
327
  // order hooks
328
+ $this->loader->add_action('woocommerce_thankyou', $service, 'onNewOrder', 1);
329
+ $this->loader->add_action('woocommerce_api_create_order', $service, 'handleOrderStatusChanged', 10);
330
+ $this->loader->add_action('woocommerce_order_status_changed', $service, 'handleOrderStatusChanged', 2);
331
 
332
  // cart hooks
333
  $this->loader->add_action('woocommerce_cart_updated', $service, 'handleCartUpdated');
389
  public function get_version() {
390
  return $this->version;
391
  }
 
392
  }
includes/processes/class-mailchimp-woocommerce-single-order.php CHANGED
@@ -13,24 +13,22 @@ class MailChimp_WooCommerce_Single_Order extends WP_Job
13
  public $order_id;
14
  public $cart_session_id;
15
  public $campaign_id;
 
 
16
 
17
  /**
18
  * MailChimp_WooCommerce_Single_Order constructor.
19
  * @param null $order_id
20
  * @param null $cart_session_id
21
  * @param null $campaign_id
 
22
  */
23
- public function __construct($order_id = null, $cart_session_id = null, $campaign_id = null)
24
  {
25
- if (!empty($order_id)) {
26
- $this->order_id = $order_id;
27
- }
28
- if (!empty($cart_session_id)) {
29
- $this->cart_session_id = $cart_session_id;
30
- }
31
- if (!empty($campaign_id)) {
32
- $this->campaign_id = $campaign_id;
33
- }
34
  }
35
 
36
  /**
@@ -39,7 +37,6 @@ class MailChimp_WooCommerce_Single_Order extends WP_Job
39
  public function handle()
40
  {
41
  $this->process();
42
-
43
  return false;
44
  }
45
 
@@ -57,12 +54,18 @@ class MailChimp_WooCommerce_Single_Order extends WP_Job
57
  // set the campaign ID
58
  $job->campaign_id = $this->campaign_id;
59
 
60
- $call = $api->getStoreOrder($store_id, $this->order_id) ? 'updateStoreOrder' : 'addStoreOrder';
 
 
 
 
61
 
62
  // if we already pushed this order into the system, we need to unset it now just in case there
63
  // was another campaign that had been sent and this was only an order update.
64
  if ($call === 'updateStoreOrder') {
65
  $job->campaign_id = null;
 
 
66
  }
67
 
68
  // will either add or update the order
@@ -76,9 +79,21 @@ class MailChimp_WooCommerce_Single_Order extends WP_Job
76
 
77
  $log = "$call :: #{$order->getId()} :: email: {$order->getCustomer()->getEmailAddress()}";
78
 
79
- if (!empty($this->campaign_id) && $call === 'addStoreOrder') {
80
- $log .= ' :: campaign id '.$this->campaign_id;
81
- $order->setCampaignId($this->campaign_id);
 
 
 
 
 
 
 
 
 
 
 
 
82
  }
83
 
84
  mailchimp_log('order_submit.submitting', $log);
@@ -147,3 +162,4 @@ class MailChimp_WooCommerce_Single_Order extends WP_Job
147
  return false;
148
  }
149
  }
 
13
  public $order_id;
14
  public $cart_session_id;
15
  public $campaign_id;
16
+ public $landing_site;
17
+ public $is_update = false;
18
 
19
  /**
20
  * MailChimp_WooCommerce_Single_Order constructor.
21
  * @param null $order_id
22
  * @param null $cart_session_id
23
  * @param null $campaign_id
24
+ * @param null $landing_site
25
  */
26
+ public function __construct($order_id = null, $cart_session_id = null, $campaign_id = null, $landing_site = null)
27
  {
28
+ if (!empty($order_id)) $this->order_id = $order_id;
29
+ if (!empty($cart_session_id)) $this->cart_session_id = $cart_session_id;
30
+ if (!empty($campaign_id)) $this->campaign_id = $campaign_id;
31
+ if (!empty($landing_site)) $this->landing_site = $landing_site;
 
 
 
 
 
32
  }
33
 
34
  /**
37
  public function handle()
38
  {
39
  $this->process();
 
40
  return false;
41
  }
42
 
54
  // set the campaign ID
55
  $job->campaign_id = $this->campaign_id;
56
 
57
+ $call = ($api_response = $api->getStoreOrder($store_id, $this->order_id)) ? 'updateStoreOrder' : 'addStoreOrder';
58
+
59
+ if ($call === 'addStoreOrder' && $this->is_update === true) {
60
+ return false;
61
+ }
62
 
63
  // if we already pushed this order into the system, we need to unset it now just in case there
64
  // was another campaign that had been sent and this was only an order update.
65
  if ($call === 'updateStoreOrder') {
66
  $job->campaign_id = null;
67
+ $this->campaign_id = null;
68
+ $this->landing_site = null;
69
  }
70
 
71
  // will either add or update the order
79
 
80
  $log = "$call :: #{$order->getId()} :: email: {$order->getCustomer()->getEmailAddress()}";
81
 
82
+ // only do this stuff on new orders
83
+ if ($call === 'addStoreOrder') {
84
+
85
+ // apply a campaign id if we have one.
86
+ if (!empty($this->campaign_id)) {
87
+ $log .= ' :: campaign id ' . $this->campaign_id;
88
+ $order->setCampaignId($this->campaign_id);
89
+ }
90
+
91
+ // apply the landing site if we have one.
92
+ if (!empty($this->landing_site)) {
93
+ $log .= ' :: landing site ' . $this->landing_site;
94
+ $order->setLandingSite($this->landing_site);
95
+ }
96
+
97
  }
98
 
99
  mailchimp_log('order_submit.submitting', $log);
162
  return false;
163
  }
164
  }
165
+
mailchimp-woocommerce.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin Name: MailChimp for WooCommerce
17
  * Plugin URI: https://mailchimp.com/connect-your-store/
18
  * Description: MailChimp - WooCommerce plugin
19
- * Version: 1.0.70
20
  * Author: MailChimp
21
  * Author URI: https://mailchimp.com
22
  * License: GPL-2.0+
@@ -39,7 +39,7 @@ function mailchimp_environment_variables() {
39
  return (object) array(
40
  'repo' => 'master',
41
  'environment' => 'production',
42
- 'version' => '1.0.70',
43
  'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version),
44
  );
45
  }
@@ -349,8 +349,16 @@ if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
349
  $_SERVER['REMOTE_ADDR'] = $forwarded_address[0];
350
  }
351
 
 
 
 
 
 
 
352
  /** Add the plugin updater function ONLY when they are logged in as admin. */
353
  add_action('admin_init', 'run_mailchimp_plugin_updater');
354
 
355
  /** Add all the MailChimp hooks. */
356
  run_mailchimp_woocommerce();
 
 
16
  * Plugin Name: MailChimp for WooCommerce
17
  * Plugin URI: https://mailchimp.com/connect-your-store/
18
  * Description: MailChimp - WooCommerce plugin
19
+ * Version: 1.0.8
20
  * Author: MailChimp
21
  * Author URI: https://mailchimp.com
22
  * License: GPL-2.0+
39
  return (object) array(
40
  'repo' => 'master',
41
  'environment' => 'production',
42
+ 'version' => '1.0.8',
43
  'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version),
44
  );
45
  }
349
  $_SERVER['REMOTE_ADDR'] = $forwarded_address[0];
350
  }
351
 
352
+ function mailchimp_woocommerce_add_meta_tags() {
353
+ echo '<meta name="referrer" content="always"/>';
354
+ }
355
+
356
+ add_action('wp_head', 'mailchimp_woocommerce_add_meta_tags');
357
+
358
  /** Add the plugin updater function ONLY when they are logged in as admin. */
359
  add_action('admin_init', 'run_mailchimp_plugin_updater');
360
 
361
  /** Add all the MailChimp hooks. */
362
  run_mailchimp_woocommerce();
363
+
364
+