MailChimp for WooCommerce - Version 2.5.2

Version Description

Download this release

Release Info

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

Code changes from version 2.5.1 to 2.5.2

.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ .DS_Store
2
+ .idea/
3
+ _test.php
4
+ vendor/
CHANGELOG.txt CHANGED
@@ -1,4 +1,8 @@
1
  == Changelog ==
 
 
 
 
2
  = 2.5.1 =
3
  * tested for woocommerce v5.1
4
  * tested for wordpress v5.7
1
  == Changelog ==
2
+ = 2.5.2 =
3
+ * cache gdpr fields for performance
4
+ * force a currency code when not present
5
+ * allow admins to see a newsletter checkbox if configured
6
  = 2.5.1 =
7
  * tested for woocommerce v5.1
8
  * tested for wordpress v5.7
README.txt CHANGED
@@ -3,11 +3,11 @@ Contributors: ryanhungate, Mailchimp
3
  Tags: ecommerce,email,workflows,mailchimp
4
  Donate link: https://mailchimp.com
5
  Requires at least: 4.9
6
- Tested up to: 5.7
7
- Stable tag: 2.5.1
8
  Requires PHP: 7.0
9
  WC requires at least: 3.5
10
- WC tested up to: 5.1
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
  Connect your store to your Mailchimp audience to track sales, create targeted emails, send abandoned cart emails, and more.
@@ -77,9 +77,10 @@ At this time, the synchronization of product categories from WooCommerce to Mail
77
  If you are unable to sync or connect with Mailchimp, you can open a ticket on our [Github plugin page](https://github.com/mailchimp/mc-woocommerce/issues). Please provide the version of the plugin and PHP you're using, any fatal errors in the WooCommerce logs (WooCommerce -> Status -> Logs) you're seeing, along with relevant information to the problem you're experiencing.
78
 
79
  == Changelog ==
80
- = 2.5 =
81
- * interface reskin
82
- * fix for fatal error on disabled WoooCommerce admin
 
83
 
84
  [Historical Changelog](https://raw.githubusercontent.com/mailchimp/mc-woocommerce/master/CHANGELOG.txt)
85
 
3
  Tags: ecommerce,email,workflows,mailchimp
4
  Donate link: https://mailchimp.com
5
  Requires at least: 4.9
6
+ Tested up to: 5.8
7
+ Stable tag: 2.5.2
8
  Requires PHP: 7.0
9
  WC requires at least: 3.5
10
+ WC tested up to: 5.5
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
  Connect your store to your Mailchimp audience to track sales, create targeted emails, send abandoned cart emails, and more.
77
  If you are unable to sync or connect with Mailchimp, you can open a ticket on our [Github plugin page](https://github.com/mailchimp/mc-woocommerce/issues). Please provide the version of the plugin and PHP you're using, any fatal errors in the WooCommerce logs (WooCommerce -> Status -> Logs) you're seeing, along with relevant information to the problem you're experiencing.
78
 
79
  == Changelog ==
80
+ = 2.5.2 =
81
+ * cache gdpr fields for performance
82
+ * force a currency code when not present
83
+ * allow admins to see a newsletter checkbox if configured
84
 
85
  [Historical Changelog](https://raw.githubusercontent.com/mailchimp/mc-woocommerce/master/CHANGELOG.txt)
86
 
admin/class-mailchimp-woocommerce-admin.php CHANGED
@@ -258,6 +258,22 @@ class MailChimp_WooCommerce_Admin extends MailChimp_WooCommerce_Options {
258
  if ($pagenow == 'admin.php' && isset($_GET) && isset($_GET['page']) && 'mailchimp-woocommerce' === $_GET['page']) {
259
  $this->handle_abandoned_cart_table();
260
  $this->update_db_check();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  $active_tab = isset($_GET['tab']) ? $_GET['tab'] : ($this->getOption('active_tab') ? $this->getOption('active_tab') : 'api_key');
262
  if ($active_tab == 'sync' && get_option('mailchimp-woocommerce-sync.initial_sync') == 1 && get_option('mailchimp-woocommerce-sync.completed_at') > 0 ) {
263
  $this->mailchimp_show_initial_sync_message();
@@ -1816,4 +1832,62 @@ class MailChimp_WooCommerce_Admin extends MailChimp_WooCommerce_Options {
1816
 
1817
  }
1818
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1819
  }
258
  if ($pagenow == 'admin.php' && isset($_GET) && isset($_GET['page']) && 'mailchimp-woocommerce' === $_GET['page']) {
259
  $this->handle_abandoned_cart_table();
260
  $this->update_db_check();
261
+
262
+ /// this is where we need to cache this data for a longer period of time and only during admin page views.
263
+ /// https://wordpress.org/support/topic/the-plugin-slows-down-the-website-because-of-slow-api/#post-14339311
264
+ if (mailchimp_is_configured() && ($list_id = mailchimp_get_list_id())) {
265
+ $transient = "mailchimp-woocommerce-gdpr-fields.{$list_id}";
266
+ $GDPRfields = get_site_transient($transient);
267
+ if (!is_array($GDPRfields)) {
268
+ try {
269
+ $GDPRfields = mailchimp_get_api()->getGDPRFields($list_id);
270
+ set_site_transient($transient, $GDPRfields, 0);
271
+ } catch (\Exception $e) {
272
+ set_site_transient($transient, array(), 60);
273
+ }
274
+ }
275
+ }
276
+
277
  $active_tab = isset($_GET['tab']) ? $_GET['tab'] : ($this->getOption('active_tab') ? $this->getOption('active_tab') : 'api_key');
278
  if ($active_tab == 'sync' && get_option('mailchimp-woocommerce-sync.initial_sync') == 1 && get_option('mailchimp-woocommerce-sync.completed_at') > 0 ) {
279
  $this->mailchimp_show_initial_sync_message();
1832
 
1833
  }
1834
 
1835
+ public function save()
1836
+ {
1837
+ if (MC_Flag::isOn(MC_FlagNames::FIX_ECOMMERCE_CUSTOMER_STATS)) {
1838
+ $existing_order_record = null;
1839
+ $is_existing_order = $this->existsInDatabase();
1840
+ $no_customer_for_existing_order = false;
1841
+ if ($is_existing_order) {
1842
+ $existing_order_record = MC::userDB()->queryOne('from Ecommerce_Order where store_id = ? and order_id = ? limit 1', [$this->store_id, $this->order_id]);
1843
+ $no_customer_for_existing_order = $existing_order_record ? $existing_order_record->getCustomer() === null : true;
1844
+ }
1845
+ $result = parent::save();
1846
+ $customer = $this->getCustomer();
1847
+ if ($customer !== null) {
1848
+ // Did we just save a new line item record?
1849
+ if (!$is_existing_order) {
1850
+ // Is this line item a completely new order or some addition to an existing order?
1851
+ $has_another_line_item = (bool)MC::userDB()->querySqlOne('select 1 from ecommerce_orders where store_id = ? and order_foreign_id = ? and order_id != ? and is_deleted = ? limit 1', [$this->store_id, $this->order_foreign_id, $this->order_id, 'N']);
1852
+ if (!$has_another_line_item) {
1853
+ $customer->incrementOrdersCount();
1854
+ $customer->addOrderToTotalSpent($this);
1855
+ }
1856
+ // Did we just make an update to an existing line item?
1857
+ } elseif ($existing_order_record) {
1858
+ $is_order_total_mismatched_with_other_line_items = (bool)MC::userDB()->querySqlOne('select 1 from ecommerce_orders where store_id = ? and order_foreign_id = ? and order_total != ? and is_deleted = ? limit 1', [$this->store_id, $this->order_foreign_id, $this->order_total, 'N']);
1859
+ // Only update if all the line items say the same order_total
1860
+ if (!$is_order_total_mismatched_with_other_line_items) {
1861
+ $customer->total_spent = $customer->total_spent - $existing_order_record->order_total + $this->order_total;
1862
+ }
1863
+ if ($no_customer_for_existing_order) {
1864
+ $customer->incrementOrdersCount();
1865
+ }
1866
+ }
1867
+ $customer->save();
1868
+ $this->customer = $customer;
1869
+ }
1870
+ return $result;
1871
+ }
1872
+ // Non-flagged behavior
1873
+ return parent::save();
1874
+ }
1875
+
1876
+ public function onDelete()
1877
+ {
1878
+ parent::onDelete();
1879
+ if (MC_Flag::isOn(MC_FlagNames::FIX_ECOMMERCE_CUSTOMER_STATS)) {
1880
+ $has_another_line_item = MC::userDB()->querySqlOne('select 1 from ecommerce_orders where store_id = ? and order_foreign_id != ? and is_deleted = ? limit 1', [$this->store_id, $this->order_foreign_id, 'N']);
1881
+ if (!$has_another_line_item) {
1882
+ $customer = $this->getCustomer();
1883
+ if ($customer !== null) {
1884
+ $customer->total_spent -= $this->order_total;
1885
+ $customer->decrementOrdersCount();
1886
+ $customer->save();
1887
+ $this->customer = $customer;
1888
+ }
1889
+ }
1890
+ }
1891
+ }
1892
+
1893
  }
admin/js/mailchimp-woocommerce-admin.js CHANGED
@@ -632,115 +632,6 @@
632
  }
633
  });
634
 
635
- $('a#mc-woocommerce-support-form-submit').click(function (e) {
636
- var accountId = $('input#account_id');
637
- var storeId = $('input#store_id');
638
- var email = $('input#email');
639
- var firstName = $('input#first_name');
640
- var lastName = $('input#last_name');
641
- var subject = $('input#subject');
642
- var message = $('textarea#message');
643
-
644
- var isValid = true;
645
-
646
- var spinner = $(this).next('.spinner');
647
- spinner.css('visibility', 'visible');
648
- $('#success').hide();
649
- $('#error').hide();
650
-
651
- if (! email[0].checkValidity()) {
652
- $('#email_error').show();
653
- isValid= false;
654
- }
655
- else {
656
- $('#email_error').hide();
657
- }
658
-
659
- if (! firstName[0].checkValidity()) {
660
- $('#first_name_error').show();
661
- isValid= false;
662
- }
663
- else {
664
- $('#first_name_error').hide();
665
- }
666
-
667
- if (! lastName[0].checkValidity()) {
668
- $('#last_name_error').show();
669
- isValid= false;
670
- }
671
- else {
672
- $('#last_name_error').hide();
673
- }
674
-
675
- if (! subject[0].checkValidity()) {
676
- $('#subject_error').show();
677
- isValid= false;
678
- }
679
- else {
680
- $('#subject_error').hide();
681
- }
682
-
683
- if (! message[0].checkValidity()) {
684
- $('#message_error').show();
685
- isValid= false;
686
- }
687
- else {
688
- $('#message_error').hide();
689
- }
690
-
691
- if (isValid) {
692
- var data = {
693
- action:'mailchimp_woocommerce_support_form',
694
- data: {
695
- email: email.val(),
696
- first_name: firstName.val(),
697
- last_name: lastName.val(),
698
- subject: subject.val(),
699
- message: message.val(),
700
- account_id: accountId.val(),
701
- store_id: storeId.val(),
702
- },
703
- };
704
-
705
- Swal.fire({
706
- title: phpVars.l10n.support_message_sending,
707
- html: phpVars.l10n.please_wait,
708
- onBeforeOpen: () => {
709
- Swal.showLoading();
710
- $.post(ajaxurl, data, function(response) {
711
- Swal.hideLoading();
712
- if (response.success) {
713
- location.hash = '#mc-woocommerce-support-form-button';
714
- $('#success').show();
715
- subject.val('');
716
- message.val('');
717
- spinner.css('visibility', 'hidden');
718
- Swal.fire({
719
- icon: 'success',
720
- timer: 2000,
721
- title: phpVars.l10n.support_message_ok,
722
- html: phpVars.l10n.support_message_desc,
723
- });
724
- } else if (response.data.error) {
725
- $('#error').show();
726
- spinner.css('visibility', 'hidden');
727
- }
728
- }).fail(function (err) {
729
- Swal.fire({
730
- icon: 'error',
731
- timer: 2000,
732
- title: 'Oops, something went wrong!',
733
- html: err,
734
- });
735
- });
736
- },
737
- });
738
- }
739
- else {
740
- spinner.css('visibility', 'hidden')
741
- }
742
- });
743
-
744
  var checkbox_label = phpVars.l10n.subscribe_newsletter;
745
  var label = checkbox_label;
746
  $('#mailchimp-woocommerce-newsletter-checkbox-label').keyup(function(event){
632
  }
633
  });
634
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
635
  var checkbox_label = phpVars.l10n.subscribe_newsletter;
636
  var label = checkbox_label;
637
  $('#mailchimp-woocommerce-newsletter-checkbox-label').keyup(function(event){
admin/partials/tabs/plugin_settings.php CHANGED
@@ -46,7 +46,7 @@ $comm_enabled = $opt != null ? $opt : '0';
46
  <p>
47
  <?=
48
  sprintf(
49
- __('Disconnect your store from MailChimp. This action will remove all entries from the database but you will be able to reconnect anytime.', 'mailchimp-for-woocommerce'),
50
  $admin_email
51
  );?>
52
  </p>
46
  <p>
47
  <?=
48
  sprintf(
49
+ __('Disconnect your store from Mailchimp. This action will remove all entries from the database but you will be able to reconnect anytime.', 'mailchimp-for-woocommerce'),
50
  $admin_email
51
  );?>
52
  </p>
admin/partials/tabs/store_sync.php CHANGED
@@ -190,11 +190,12 @@ if (($mailchimp_api = mailchimp_get_api()) && ($store = $mailchimp_api->getStore
190
  <li><?= sprintf(/* translators: %s - Plugin review URL. */wp_kses( __( 'Is this plugin helping your e-commerce business? <a href=%s target=_blank>Please leave us a ★★★★★ review!</a>.', 'mailchimp-for-woocommerce' ), array( 'a' => array( 'href' => array(), 'target'=> '_blank' ) ) ), esc_url( 'https://wordpress.org/support/plugin/mailchimp-for-woocommerce/reviews/' ) );?></li>
191
  <li><?= sprintf(/* translators: Placeholders %1$s - plugin wiki CLI URL, %2$s - plugin wiki WP caching issues url */ wp_kses( __( 'Have a larger store or having issues syncing? Consider using <a href=%1$s target=_blank>WP-CLI</a> or browse documentation around common <a href=%2$s target=_blank>caching problems</a>.', 'mailchimp-for-woocommerce' ), array( 'a' => array( 'href' => array(), 'target'=> '_blank' ) ) ), esc_url( 'https://github.com/mailchimp/mc-woocommerce/wiki/Advanced-Queue-Setup-In-CLI-mode' ), esc_url( 'https://github.com/mailchimp/mc-woocommerce/wiki/Using-Caches' ) );?></li>
192
  <li><?= esc_html__('Order and customer information will not sync if they contain an Amazon or generic email address.', 'mailchimp-for-woocommerce');?></li>
193
- <li><?= sprintf(/* translators: Placeholders %1$s - Mailchimp Support URL, %2$s - link element id, %3$s - popup element id */wp_kses( __( 'Need help? Visit <a href=%1$s target=_blank>Mailchimp support</a> or <a id=%2$s href=%3$s>send us an email.</a> ', 'mailchimp-for-woocommerce' ), array( 'a' => array( 'href' => array(), 'id' => array(), 'target'=> '_blank' ) ) ), esc_url( 'https://us1.admin.mailchimp.com/support?support_key=woo_forum' ), 'mc-woocommerce-support-form-button', '#mc-woocommerce-support-form' );?></li>
194
  <li><?= sprintf(/* translators: %s - Mailchimp Privacy Policy URL. */wp_kses( __( 'By using this plugin, Mailchimp will process customer information in accordance with their <a href=%s target=_blank>Privacy Policy</a>.', 'mailchimp-for-woocommerce' ), array( 'a' => array( 'href' => array(), 'target'=> '_blank' ) ) ), esc_url( 'https://mailchimp.com/legal/privacy/' ) );?></li>
195
  </ul>
196
  </div>
197
  </div>
 
198
  <div class="box box-half resync-container">
199
  <div class="content ">
200
  <h3 style="padding-top: 1em;"><?php esc_html_e('Synchronization', 'mailchimp-for-woocommerce');?></h3>
@@ -210,92 +211,4 @@ if (($mailchimp_api = mailchimp_get_api()) && ($store = $mailchimp_api->getStore
210
  <?php endif;?>
211
  </div>
212
  </div>
213
- </div>
214
-
215
- <div id="mc-woocommerce-support-form" class="mc-woocommerce-modal">
216
- <div id="exampleModal" class="reveal-modal">
217
- <a href="#mc-woocommerce-support-form-button" class="close-modal"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
218
- <path d="M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z" fill="black"/>
219
- </svg>
220
- </a>
221
- <div class="modal-header">
222
- <svg width="50px" height="50px" viewBox="0 0 46 49" fill="none" xmlns="http://www.w3.org/2000/svg">
223
- <path d="M34.5458 23.5193C34.8988 23.4778 35.2361 23.4759 35.5457 23.5193C35.7252 23.107 35.7568 22.397 35.5951 21.6239C35.3544 20.4741 35.029 19.7778 34.3584 19.8863C33.6859 19.9948 33.6622 20.8271 33.9028 21.9769C34.037 22.6238 34.2776 23.1761 34.5458 23.5193Z" fill="black"/>
224
- <path d="M28.7763 24.4284C29.2575 24.6394 29.5534 24.7795 29.6678 24.6572C29.7427 24.5803 29.719 24.4363 29.6046 24.2489C29.368 23.8624 28.8788 23.4679 28.3621 23.249C27.303 22.7934 26.0407 22.9453 25.0664 23.6454C24.745 23.8801 24.4393 24.2075 24.4826 24.4047C24.4965 24.4698 24.5458 24.5172 24.6582 24.5329C24.9225 24.5625 25.8494 24.0951 26.9164 24.03C27.6718 23.9827 28.295 24.2174 28.7763 24.4284Z" fill="black"/>
225
- <path d="M27.8105 24.9806C27.1852 25.0793 26.8381 25.2863 26.6172 25.4777C26.4279 25.6433 26.3115 25.8267 26.3115 25.9549C26.3115 26.0161 26.3391 26.0516 26.3589 26.0693C26.3865 26.095 26.422 26.1088 26.4614 26.1088C26.6034 26.1088 26.919 25.9826 26.919 25.9826C27.7907 25.6709 28.3647 25.7084 28.9346 25.7735C29.2502 25.809 29.3981 25.8287 29.4672 25.7202C29.4869 25.6887 29.5125 25.6216 29.4494 25.521C29.3054 25.2804 28.6723 24.8781 27.8105 24.9806Z" fill="black"/>
226
- <path d="M32.5975 27.0061C33.0235 27.2152 33.4909 27.1324 33.6428 26.8227C33.7946 26.5131 33.5737 26.093 33.1497 25.8839C32.7237 25.6749 32.2563 25.7577 32.1044 26.0673C31.9506 26.377 32.1734 26.7971 32.5975 27.0061Z" fill="black"/>
227
- <path d="M35.3306 24.6177C34.9854 24.6118 34.6995 24.9905 34.6916 25.4638C34.6837 25.9372 34.9578 26.3257 35.303 26.3317C35.6481 26.3376 35.9341 25.9589 35.942 25.4855C35.9499 25.0122 35.6757 24.6237 35.3306 24.6177Z" fill="black"/>
228
- <path d="M12.1324 33.1577C12.0456 33.0492 11.9056 33.0827 11.7695 33.1143C11.6749 33.136 11.5664 33.1616 11.448 33.1596C11.1936 33.1557 10.9786 33.0452 10.8583 32.8598C10.7006 32.6192 10.7104 32.2583 10.884 31.8461C10.9076 31.7909 10.9353 31.7297 10.9648 31.6607C11.241 31.0394 11.7064 30 11.1857 29.008C10.7932 28.2625 10.1542 27.797 9.38702 27.7004C8.64939 27.6077 7.89006 27.8798 7.40685 28.4143C6.64358 29.2565 6.52328 30.4044 6.6712 30.8087C6.72445 30.9566 6.80925 30.998 6.87237 31.0059C7.00254 31.0237 7.19385 30.929 7.31416 30.6055C7.32205 30.5819 7.33388 30.5464 7.34769 30.501C7.40094 30.3294 7.50152 30.0099 7.66522 29.7555C7.86245 29.4478 8.17012 29.2348 8.53105 29.1579C8.89789 29.079 9.2746 29.15 9.58819 29.3551C10.1227 29.7062 10.3298 30.361 10.101 30.9862C9.98264 31.3096 9.79133 31.9289 9.83275 32.4378C9.91756 33.4673 10.5507 33.8795 11.1206 33.9249C11.6729 33.9466 12.0594 33.6349 12.1581 33.4081C12.2133 33.274 12.164 33.1932 12.1324 33.1577Z" fill="black"/>
229
- <path d="M44.044 31.2761C44.0223 31.2012 43.8862 30.7002 43.6969 30.0967C43.5075 29.4932 43.3142 29.0672 43.3142 29.0672C44.0696 27.9351 44.0834 26.9233 43.9828 26.3514C43.8763 25.6414 43.5805 25.0359 42.9829 24.4107C42.3873 23.7854 41.1684 23.1445 39.4545 22.6632C39.2593 22.608 38.6123 22.4305 38.5551 22.4127C38.5512 22.3753 38.5078 20.2945 38.4684 19.3991C38.4408 18.7522 38.3836 17.7444 38.0719 16.7504C37.6992 15.4053 37.0483 14.2298 36.2377 13.4764C38.4763 11.157 39.8726 8.60091 39.8707 6.40774C39.8647 2.19102 34.6855 0.914962 28.3033 3.55781C28.2974 3.55978 26.9602 4.1278 26.9503 4.13174C26.9444 4.12582 24.5066 1.73346 24.4692 1.7019C17.1954 -4.64488 -5.55475 20.6436 1.71899 26.7853L3.30864 28.1323C2.89644 29.2013 2.73471 30.4241 2.86685 31.7396C3.03647 33.4299 3.90822 35.0511 5.32234 36.3015C6.66348 37.4908 8.42669 38.2422 10.1386 38.2402C12.9688 44.7626 19.4359 48.7643 27.0193 48.9891C35.153 49.2317 41.981 45.4134 44.8428 38.5578C45.0301 38.0765 45.825 35.909 45.825 33.9939C45.825 32.0729 44.7382 31.2761 44.044 31.2761ZM10.7638 36.41C10.5173 36.4514 10.2649 36.4691 10.0104 36.4632C7.55298 36.3981 4.90027 34.1852 4.63598 31.5621C4.34409 28.6629 5.82527 26.4322 8.44839 25.9017C8.76198 25.8386 9.14066 25.8011 9.54892 25.8228C11.0183 25.9037 13.1838 27.0318 13.6789 30.2328C14.1187 33.0689 13.4225 35.9564 10.7638 36.41ZM8.02041 24.1681C6.38736 24.4856 4.9476 25.4106 4.06797 26.6886C3.54137 26.2508 2.56115 25.4007 2.38956 25.0694C0.985306 22.4009 3.92202 17.2138 5.97516 14.285C11.0478 7.04676 18.9922 1.56581 22.6705 2.55984C23.2681 2.72945 25.2482 5.02518 25.2482 5.02518C25.2482 5.02518 21.5719 7.06451 18.1618 9.90853C13.5704 13.4468 10.0992 18.5885 8.02041 24.1681ZM33.8079 35.3252C33.8611 35.3035 33.8986 35.2424 33.8927 35.1812C33.8848 35.1063 33.8177 35.0531 33.7448 35.0609C33.7448 35.0609 29.8969 35.6309 26.26 34.2996C26.6564 33.0117 27.7096 33.4772 29.3012 33.6054C32.1709 33.777 34.7408 33.3569 36.642 32.8125C38.2889 32.3392 40.4505 31.4083 42.1309 30.0829C42.6969 31.3274 42.8981 32.6962 42.8981 32.6962C42.8981 32.6962 43.3359 32.6173 43.7028 32.8441C44.0499 33.0571 44.3024 33.5009 44.1288 34.6448C43.7758 36.7847 42.8665 38.5223 41.338 40.1198C40.4071 41.1217 39.277 41.9935 37.9852 42.6266C37.2988 42.9875 36.5671 43.2991 35.7959 43.5516C30.033 45.4331 24.1339 43.3642 22.2326 38.9207C22.0807 38.5874 21.9525 38.2363 21.852 37.8714C21.0414 34.9426 21.7297 31.43 23.8795 29.2171C23.8795 29.2171 23.8795 29.2171 23.8795 29.2151C24.0116 29.0751 24.1477 28.9094 24.1477 28.7004C24.1477 28.5248 24.0372 28.3414 23.9406 28.2112C23.1892 27.1206 20.5818 25.2607 21.1045 21.6613C21.4792 19.0757 23.7414 17.2553 25.8498 17.3637C26.0273 17.3736 26.2067 17.3834 26.3842 17.3953C27.2974 17.4485 28.0942 17.5669 28.8476 17.5984C30.1059 17.6537 31.238 17.4702 32.5792 16.3519C33.0308 15.9752 33.3937 15.6478 34.0071 15.5453C34.0722 15.5335 34.2319 15.4763 34.5534 15.492C34.8808 15.5098 35.1924 15.5985 35.4725 15.7859C36.5474 16.5018 36.6992 18.2335 36.7545 19.4997C36.786 20.2235 36.8728 21.9729 36.9044 22.4759C36.9734 23.6237 37.2751 23.7874 37.8846 23.9886C38.2278 24.101 38.5473 24.1858 39.0167 24.318C40.4387 24.7183 41.2828 25.1227 41.8153 25.6433C42.1329 25.9688 42.2808 26.3139 42.3261 26.6433C42.4938 27.8661 41.3755 29.3788 38.4171 30.7515C35.1826 32.2524 31.2577 32.6331 28.5459 32.3313C28.3388 32.3076 27.5992 32.2248 27.5952 32.2248C25.4257 31.9329 24.1891 34.7355 25.4908 36.6565C26.329 37.8951 28.6149 38.6998 30.9008 38.6998C36.1431 38.6998 40.1724 36.4613 41.6713 34.5284C41.7167 34.4712 41.7206 34.4633 41.7916 34.3568C41.8646 34.2464 41.8055 34.1852 41.7128 34.2464C40.488 35.0846 35.0484 38.4099 29.2322 37.4099C29.2322 37.4099 28.5261 37.2936 27.8792 37.0431C27.3664 36.8439 26.2935 36.3508 26.1634 35.2483C30.8514 36.6979 33.8079 35.3252 33.8079 35.3252ZM26.3704 34.4476C26.3704 34.4476 26.3724 34.4476 26.3704 34.4476C26.3724 34.4495 26.3724 34.4495 26.3724 34.4515C26.3724 34.4495 26.3724 34.4476 26.3704 34.4476ZM17.3887 14.2554C19.1914 12.1707 21.4121 10.3602 23.4002 9.34249C23.4692 9.30699 23.5422 9.38193 23.5047 9.44899C23.3469 9.73497 23.0432 10.3464 22.9466 10.8118C22.9308 10.8848 23.0097 10.9381 23.0708 10.8966C24.3074 10.0525 26.4612 9.14921 28.3486 9.03284C28.4295 9.02693 28.4689 9.13146 28.4039 9.18076C28.1159 9.40166 27.8023 9.70539 27.5735 10.0131C27.5341 10.0663 27.5716 10.1413 27.6366 10.1413C28.962 10.1511 30.8317 10.6146 32.0486 11.297C32.1315 11.3424 32.0723 11.5021 31.9796 11.4824C30.1375 11.0603 27.1199 10.7389 23.986 11.5041C21.1893 12.1865 19.0533 13.2397 17.4952 14.3738C17.4203 14.4329 17.3256 14.3304 17.3887 14.2554Z" fill="black"/>
230
- </svg>
231
- <h3><?= __('Send us a support ticket', 'mailchimp-for-woocommerce');?></h3>
232
- <p class="description support-form"><?= __('The best way to get in touch with us is by submitting a ticket in the form below. </br> We do our best to get back to you within 48 hours. We look forward to hear from you!', 'mailchimp-for-woocommerce');?></p>
233
-
234
- </div>
235
-
236
- <div id="mc-woocommerce-create-account-step-1" class="mc-woocommerce-create-account-step tab-content-wrapper" >
237
- <fieldset >
238
- <?php $user_id = get_current_user_id(); ?>
239
-
240
- <input id="store_id" name="store_id" type="hidden" value="<?= mailchimp_get_store_id(); ?>">
241
- <input id="account_id" name="account_id" type="hidden" value="<?= $account_details['account_id']?>">
242
- <input id="org" name="org" type="hidden" value="<?= get_bloginfo( 'name' );?>">
243
-
244
- <div class="box box-half" >
245
- <label for="first_name">
246
- <span> <?php esc_html_e('First name', 'mailchimp-for-woocommerce'); ?></span>
247
- </label>
248
- <input required type="text" id="first_name" name="first_name_edited" value="<?= $account_details['first_name']?>"/>
249
- </div>
250
-
251
- <div class="box box-half" >
252
- <label for="last_name">
253
- <span> <?php esc_html_e('Last name', 'mailchimp-for-woocommerce'); ?></span>
254
- </label>
255
- <input required type="text" id="last_name" name="last_name_edited" value="<?= $account_details['last_name']?>"/>
256
- </div>
257
-
258
- <div class="box" >
259
- <label for="email">
260
- <span> <?php esc_html_e('Email', 'mailchimp-for-woocommerce'); ?></span>
261
- </label>
262
- <input required type="email" id="email" name="email" value="<?= $account_details['email']?>"/>
263
- </div>
264
-
265
- <div class="box" >
266
- <label for="subject">
267
- <span> <?php esc_html_e('Subject', 'mailchimp-for-woocommerce'); ?></span>
268
- </label>
269
- <input required type="text" id="subject" name="subject"/>
270
- </div>
271
-
272
- <div class="box" >
273
- <label for="message">
274
- <span> <?php esc_html_e('Message', 'mailchimp-for-woocommerce'); ?></span>
275
- </label>
276
- <textarea required id="message" name="message"></textarea>
277
- </div>
278
-
279
- <div class="box">
280
- <a id="mc-woocommerce-support-form-submit" class="button button-primary whitebtn tab-content-submit"><?php esc_html_e('Send', 'mailchimp-for-woocommerce'); ?></a>
281
- <span class="spinner"></span>
282
- </div>
283
-
284
- <div class="box mc-woocommerce-create-account-step-error alignright" >
285
- <p id ="email_error"><?= esc_html__( 'Invalid Email. Please double check.', 'mailchimp-for-woocommerce' ); ?></p>
286
- <p id ="first_name_error"><?= esc_html__( 'Invalid First Name. Please double check.', 'mailchimp-for-woocommerce' ); ?></p>
287
- <p id ="last_name_error"><?= esc_html__( 'Invalid Last Name. Please double check.', 'mailchimp-for-woocommerce' ); ?></p>
288
- <p id ="subject_error"><?= esc_html__( 'Invalid Subject. Please double check.', 'mailchimp-for-woocommerce' ); ?></p>
289
- <p id ="message_error"><?= esc_html__( 'Invalid Message. Please double check.', 'mailchimp-for-woocommerce' ); ?></p>
290
- <p id ="success"><?= esc_html__( 'Message sent...', 'mailchimp-for-woocommerce' ); ?></p>
291
- <p id ="error"><?= esc_html__( 'Error: Message not sent...', 'mailchimp-for-woocommerce' ); ?></p>
292
- </div>
293
-
294
- </fieldset>
295
- </div>
296
- <div class="modal-footer">
297
- ©2001–<?= date('Y') ?> All Rights Reserved. Mailchimp® is a registered trademark of The Rocket Science Group. Cookie Preferences, Privacy, and Terms.
298
- </div>
299
-
300
- </div>
301
  </div>
190
  <li><?= sprintf(/* translators: %s - Plugin review URL. */wp_kses( __( 'Is this plugin helping your e-commerce business? <a href=%s target=_blank>Please leave us a ★★★★★ review!</a>.', 'mailchimp-for-woocommerce' ), array( 'a' => array( 'href' => array(), 'target'=> '_blank' ) ) ), esc_url( 'https://wordpress.org/support/plugin/mailchimp-for-woocommerce/reviews/' ) );?></li>
191
  <li><?= sprintf(/* translators: Placeholders %1$s - plugin wiki CLI URL, %2$s - plugin wiki WP caching issues url */ wp_kses( __( 'Have a larger store or having issues syncing? Consider using <a href=%1$s target=_blank>WP-CLI</a> or browse documentation around common <a href=%2$s target=_blank>caching problems</a>.', 'mailchimp-for-woocommerce' ), array( 'a' => array( 'href' => array(), 'target'=> '_blank' ) ) ), esc_url( 'https://github.com/mailchimp/mc-woocommerce/wiki/Advanced-Queue-Setup-In-CLI-mode' ), esc_url( 'https://github.com/mailchimp/mc-woocommerce/wiki/Using-Caches' ) );?></li>
192
  <li><?= esc_html__('Order and customer information will not sync if they contain an Amazon or generic email address.', 'mailchimp-for-woocommerce');?></li>
193
+ <li><?= sprintf(/* translators: Placeholders %1$s - Mailchimp Support URL, %2$s - link element id, %3$s - popup element id */wp_kses( __( 'Need help? Visit <a href=%1$s target=_blank>Mailchimp support</a>', 'mailchimp-for-woocommerce' ), array( 'a' => array( 'href' => array(), 'id' => array(), 'target'=> '_blank' ) ) ), esc_url( 'https://us1.admin.mailchimp.com/support?support_key=woo_forum' ) );?></li>
194
  <li><?= sprintf(/* translators: %s - Mailchimp Privacy Policy URL. */wp_kses( __( 'By using this plugin, Mailchimp will process customer information in accordance with their <a href=%s target=_blank>Privacy Policy</a>.', 'mailchimp-for-woocommerce' ), array( 'a' => array( 'href' => array(), 'target'=> '_blank' ) ) ), esc_url( 'https://mailchimp.com/legal/privacy/' ) );?></li>
195
  </ul>
196
  </div>
197
  </div>
198
+
199
  <div class="box box-half resync-container">
200
  <div class="content ">
201
  <h3 style="padding-top: 1em;"><?php esc_html_e('Synchronization', 'mailchimp-for-woocommerce');?></h3>
211
  <?php endif;?>
212
  </div>
213
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  </div>
bootstrap.php CHANGED
@@ -87,7 +87,7 @@ function mailchimp_environment_variables() {
87
  return (object) array(
88
  'repo' => 'master',
89
  'environment' => 'production', // staging or production
90
- 'version' => '2.5.1',
91
  'php_version' => phpversion(),
92
  'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version),
93
  'wc_version' => function_exists('WC') ? WC()->version : null,
@@ -1279,6 +1279,22 @@ function mailchimp_set_cookie($name, $value, $expire, $path, $domain = '', $secu
1279
  ]);
1280
  }
1281
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1282
 
1283
  // Add WP CLI commands
1284
  if (defined( 'WP_CLI' ) && WP_CLI) {
87
  return (object) array(
88
  'repo' => 'master',
89
  'environment' => 'production', // staging or production
90
+ 'version' => '2.5.2',
91
  'php_version' => phpversion(),
92
  'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version),
93
  'wc_version' => function_exists('WC') ? WC()->version : null,
1279
  ]);
1280
  }
1281
 
1282
+ /**
1283
+ * We will allow people to filter this value - turn it off if they would like.
1284
+ * add_filter( 'mailchimp_allowed_to_use_cookie', 'custom_cookie_callback_function', 10, 1 );
1285
+ * @return bool
1286
+ */
1287
+ function mailchimp_allowed_to_use_cookie($cookie) {
1288
+ $result = apply_filters('mailchimp_allowed_to_use_cookie', $cookie);
1289
+ if (is_bool($result)) return $result;
1290
+ return $result === $cookie;
1291
+ }
1292
+
1293
+ // the cookie name will be whatever we're trying to set, but the most simple
1294
+ // return the $cookie_name if you will allow it -
1295
+ // otherwise it is going to turn this feature off.
1296
+
1297
+
1298
 
1299
  // Add WP CLI commands
1300
  if (defined( 'WP_CLI' ) && WP_CLI) {
includes/api/assets/class-mailchimp-order.php CHANGED
@@ -300,7 +300,7 @@ class MailChimp_WooCommerce_Order
300
  */
301
  public function getCurrencyCode()
302
  {
303
- return $this->currency_code;
304
  }
305
 
306
  /**
300
  */
301
  public function getCurrencyCode()
302
  {
303
+ return !empty($this->currency_code) ? $this->currency_code : 'USD';
304
  }
305
 
306
  /**
includes/api/class-mailchimp-api.php CHANGED
@@ -1616,7 +1616,7 @@ class MailChimp_WooCommerce_MailChimpApi
1616
  public function getGDPRFields($list_id)
1617
  {
1618
  $one_member = $this->get("lists/$list_id/members?fields=members.marketing_permissions&count=1");
1619
- $fields = false;
1620
 
1621
  if (is_array($one_member) &&
1622
  isset($one_member['members']) &&
1616
  public function getGDPRFields($list_id)
1617
  {
1618
  $one_member = $this->get("lists/$list_id/members?fields=members.marketing_permissions&count=1");
1619
+ $fields = array();
1620
 
1621
  if (is_array($one_member) &&
1622
  isset($one_member['members']) &&
includes/class-mailchimp-woocommerce-newsletter.php CHANGED
@@ -32,7 +32,11 @@ class MailChimp_Newsletter extends MailChimp_WooCommerce_Options
32
  */
33
  public function applyNewsletterField($checkout)
34
  {
35
- if (!is_admin()) {
 
 
 
 
36
  $api = mailchimp_get_api();
37
 
38
  // get the gdpr fields from the cache - or call it again and save for 5 minutes.
32
  */
33
  public function applyNewsletterField($checkout)
34
  {
35
+ // some folks have asked to be able to check out on behalf of customers. I guess this makes sense
36
+ // if they want to do this, but it needs to be a constant and custom.
37
+ $allow_admin = defined('MAILCHIMP_ALLOW_ADMIN_NEWSLETTER') && MAILCHIMP_ALLOW_ADMIN_NEWSLETTER;
38
+
39
+ if ($allow_admin || !is_admin()) {
40
  $api = mailchimp_get_api();
41
 
42
  // get the gdpr fields from the cache - or call it again and save for 5 minutes.
includes/class-mailchimp-woocommerce-service.php CHANGED
@@ -62,7 +62,8 @@ class MailChimp_Service extends MailChimp_WooCommerce_Options
62
  */
63
  protected function cookie($key, $default = null)
64
  {
65
- if ($this->is_admin) {
 
66
  return $default;
67
  }
68
 
@@ -478,6 +479,10 @@ class MailChimp_Service extends MailChimp_WooCommerce_Options
478
  */
479
  public function handleCampaignTracking()
480
  {
 
 
 
 
481
  // set the landing site cookie if we don't have one.
482
  $this->setLandingSiteCookie();
483
 
@@ -600,6 +605,11 @@ class MailChimp_Service extends MailChimp_WooCommerce_Options
600
  */
601
  public function setLandingSiteCookie()
602
  {
 
 
 
 
 
603
  if (isset($_GET['expire_landing_site'])) $this->expireLandingSiteCookie();
604
 
605
  // if we already have a cookie here, we need to skip it.
@@ -631,6 +641,9 @@ class MailChimp_Service extends MailChimp_WooCommerce_Options
631
  */
632
  public function getReferer()
633
  {
 
 
 
634
  if (!empty($_REQUEST['_wp_http_referer'])) {
635
  return wp_unslash($_REQUEST['_wp_http_referer']);
636
  } elseif (!empty($_SERVER['HTTP_REFERER'])) {
@@ -644,6 +657,10 @@ class MailChimp_Service extends MailChimp_WooCommerce_Options
644
  */
645
  public function expireLandingSiteCookie()
646
  {
 
 
 
 
647
  mailchimp_set_cookie('mailchimp_landing_site', false, $this->getCookieDuration(), '/' );
648
  $this->setWooSession('mailchimp_landing_site', false);
649
 
@@ -747,6 +764,10 @@ class MailChimp_Service extends MailChimp_WooCommerce_Options
747
  $this->respondJSON(array('success' => false));
748
  }
749
 
 
 
 
 
750
  if ($this->doingAjax() && isset($_GET['email'])) {
751
 
752
  $cookie_duration = $this->getCookieDuration();
62
  */
63
  protected function cookie($key, $default = null)
64
  {
65
+ // if we're not allowed to use cookies, just return the default
66
+ if ($this->is_admin || !mailchimp_allowed_to_use_cookie($key)) {
67
  return $default;
68
  }
69
 
479
  */
480
  public function handleCampaignTracking()
481
  {
482
+ if (!mailchimp_allowed_to_use_cookie('mailchimp_user_email')) {
483
+ return null;
484
+ }
485
+
486
  // set the landing site cookie if we don't have one.
487
  $this->setLandingSiteCookie();
488
 
605
  */
606
  public function setLandingSiteCookie()
607
  {
608
+ // if we're not allowed to use this cookie, just return
609
+ if (!mailchimp_allowed_to_use_cookie('mailchimp_landing_site')) {
610
+ return $this;
611
+ }
612
+
613
  if (isset($_GET['expire_landing_site'])) $this->expireLandingSiteCookie();
614
 
615
  // if we already have a cookie here, we need to skip it.
641
  */
642
  public function getReferer()
643
  {
644
+ if (function_exists('wp_get_referer')) {
645
+ return wp_get_referer();
646
+ }
647
  if (!empty($_REQUEST['_wp_http_referer'])) {
648
  return wp_unslash($_REQUEST['_wp_http_referer']);
649
  } elseif (!empty($_SERVER['HTTP_REFERER'])) {
657
  */
658
  public function expireLandingSiteCookie()
659
  {
660
+ if (!mailchimp_allowed_to_use_cookie('mailchimp_landing_site')) {
661
+ return $this;
662
+ }
663
+
664
  mailchimp_set_cookie('mailchimp_landing_site', false, $this->getCookieDuration(), '/' );
665
  $this->setWooSession('mailchimp_landing_site', false);
666
 
764
  $this->respondJSON(array('success' => false));
765
  }
766
 
767
+ if (!mailchimp_allowed_to_use_cookie('mailchimp_user_email')) {
768
+ $this->respondJSON(array('success' => false, 'email' => false));
769
+ }
770
+
771
  if ($this->doingAjax() && isset($_GET['email'])) {
772
 
773
  $cookie_duration = $this->getCookieDuration();
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: Connects WooCommerce to Mailchimp to sync your store data, send targeted campaigns to your customers, and sell more stuff.
19
- * Version: 2.5.1
20
  * Author: Mailchimp
21
  * Author URI: https://mailchimp.com
22
  * License: GPL-2.0+
16
  * Plugin Name: Mailchimp for WooCommerce
17
  * Plugin URI: https://mailchimp.com/connect-your-store/
18
  * Description: Connects WooCommerce to Mailchimp to sync your store data, send targeted campaigns to your customers, and sell more stuff.
19
+ * Version: 2.5.2
20
  * Author: Mailchimp
21
  * Author URI: https://mailchimp.com
22
  * License: GPL-2.0+
public/class-mailchimp-woocommerce-public.php CHANGED
@@ -63,7 +63,8 @@ class MailChimp_WooCommerce_Public {
63
  wp_localize_script($this->plugin_name, 'mailchimp_public_data', array(
64
  'site_url' => site_url(),
65
  'ajax_url' => admin_url('admin-ajax.php'),
66
- 'language' => substr( get_locale(), 0, 2 )
 
67
  ));
68
 
69
  // Enqueued script with localized data.
63
  wp_localize_script($this->plugin_name, 'mailchimp_public_data', array(
64
  'site_url' => site_url(),
65
  'ajax_url' => admin_url('admin-ajax.php'),
66
+ 'language' => substr( get_locale(), 0, 2 ),
67
+ 'allowed_to_set_cookies' => mailchimp_allowed_to_use_cookie('mailchimp_user_email'),
68
  ));
69
 
70
  // Enqueued script with localized data.
public/js/mailchimp-woocommerce-public.js CHANGED
@@ -8,6 +8,7 @@ var mailchimp,
8
 
9
  function mailchimpGetCurrentUserByHash(a) {
10
  try {
 
11
  var b = mailchimp_public_data.ajax_url + "?action=mailchimp_get_user_by_hash&hash=" + a, c = new XMLHttpRequest;
12
  c.open("POST", b, !0), c.onload = function () {
13
  if (c.status >= 200 && c.status < 400) {
@@ -28,6 +29,7 @@ function mailchimpGetCurrentUserByHash(a) {
28
  }
29
  function mailchimpHandleBillingEmail(selector) {
30
  try {
 
31
  if (!selector) selector = "#billing_email";
32
  var a = document.querySelector(selector);
33
  var b = void 0 !== a ? a.value : "";
@@ -67,23 +69,28 @@ function mailchimpHandleBillingEmail(selector) {
67
  this.previous_email = null;
68
  this.expireUser = function () {
69
  this.current_email = null;
 
70
  mailchimp.storage.expire("mailchimp.cart.current_email");
71
  };
72
  this.expireSaved = function () {
 
73
  mailchimp.storage.expire("mailchimp.cart.items");
74
  };
75
  this.setEmail = function (a) {
 
76
  if (!this.valueEmail(a)) return false;
77
  this.setPreviousEmail(this.getEmail());
78
  mailchimp.storage.set("mailchimp.cart.current_email", this.current_email = a);
79
  };
80
  this.getEmail = function () {
 
81
  if (this.current_email) return this.current_email;
82
  var a = mailchimp.storage.get("mailchimp.cart.current_email", !1);
83
  if (!a || !this.valueEmail(a)) return false;
84
  return this.current_email = a;
85
  };
86
  this.setPreviousEmail = function (a) {
 
87
  if (!this.valueEmail(a)) return false;
88
  mailchimp.storage.set("mailchimp.cart.previous_email", this.previous_email = a);
89
  };
@@ -174,6 +181,9 @@ function mailchimpHandleBillingEmail(selector) {
174
 
175
  mailchimpReady(function () {
176
 
 
 
 
177
  if (void 0 === a) {
178
  var a = { site_url: document.location.origin, defaulted: !0, ajax_url: document.location.origin + "/wp-admin?admin-ajax.php" };
179
  }
8
 
9
  function mailchimpGetCurrentUserByHash(a) {
10
  try {
11
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
12
  var b = mailchimp_public_data.ajax_url + "?action=mailchimp_get_user_by_hash&hash=" + a, c = new XMLHttpRequest;
13
  c.open("POST", b, !0), c.onload = function () {
14
  if (c.status >= 200 && c.status < 400) {
29
  }
30
  function mailchimpHandleBillingEmail(selector) {
31
  try {
32
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
33
  if (!selector) selector = "#billing_email";
34
  var a = document.querySelector(selector);
35
  var b = void 0 !== a ? a.value : "";
69
  this.previous_email = null;
70
  this.expireUser = function () {
71
  this.current_email = null;
72
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
73
  mailchimp.storage.expire("mailchimp.cart.current_email");
74
  };
75
  this.expireSaved = function () {
76
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
77
  mailchimp.storage.expire("mailchimp.cart.items");
78
  };
79
  this.setEmail = function (a) {
80
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
81
  if (!this.valueEmail(a)) return false;
82
  this.setPreviousEmail(this.getEmail());
83
  mailchimp.storage.set("mailchimp.cart.current_email", this.current_email = a);
84
  };
85
  this.getEmail = function () {
86
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
87
  if (this.current_email) return this.current_email;
88
  var a = mailchimp.storage.get("mailchimp.cart.current_email", !1);
89
  if (!a || !this.valueEmail(a)) return false;
90
  return this.current_email = a;
91
  };
92
  this.setPreviousEmail = function (a) {
93
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
94
  if (!this.valueEmail(a)) return false;
95
  mailchimp.storage.set("mailchimp.cart.previous_email", this.previous_email = a);
96
  };
181
 
182
  mailchimpReady(function () {
183
 
184
+ // if they've told us we can't do this - we have to honor it.
185
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
186
+
187
  if (void 0 === a) {
188
  var a = { site_url: document.location.origin, defaulted: !0, ajax_url: document.location.origin + "/wp-admin?admin-ajax.php" };
189
  }
public/js/mailchimp-woocommerce-public.min.js CHANGED
@@ -8,6 +8,7 @@ var mailchimp,
8
 
9
  function mailchimpGetCurrentUserByHash(a) {
10
  try {
 
11
  var b = mailchimp_public_data.ajax_url + "?action=mailchimp_get_user_by_hash&hash=" + a, c = new XMLHttpRequest;
12
  c.open("POST", b, !0), c.onload = function () {
13
  if (c.status >= 200 && c.status < 400) {
@@ -28,6 +29,7 @@ function mailchimpGetCurrentUserByHash(a) {
28
  }
29
  function mailchimpHandleBillingEmail(selector) {
30
  try {
 
31
  if (!selector) selector = "#billing_email";
32
  var a = document.querySelector(selector);
33
  var b = void 0 !== a ? a.value : "";
@@ -67,23 +69,28 @@ function mailchimpHandleBillingEmail(selector) {
67
  this.previous_email = null;
68
  this.expireUser = function () {
69
  this.current_email = null;
 
70
  mailchimp.storage.expire("mailchimp.cart.current_email");
71
  };
72
  this.expireSaved = function () {
 
73
  mailchimp.storage.expire("mailchimp.cart.items");
74
  };
75
  this.setEmail = function (a) {
 
76
  if (!this.valueEmail(a)) return false;
77
  this.setPreviousEmail(this.getEmail());
78
  mailchimp.storage.set("mailchimp.cart.current_email", this.current_email = a);
79
  };
80
  this.getEmail = function () {
 
81
  if (this.current_email) return this.current_email;
82
  var a = mailchimp.storage.get("mailchimp.cart.current_email", !1);
83
  if (!a || !this.valueEmail(a)) return false;
84
  return this.current_email = a;
85
  };
86
  this.setPreviousEmail = function (a) {
 
87
  if (!this.valueEmail(a)) return false;
88
  mailchimp.storage.set("mailchimp.cart.previous_email", this.previous_email = a);
89
  };
@@ -174,6 +181,9 @@ function mailchimpHandleBillingEmail(selector) {
174
 
175
  mailchimpReady(function () {
176
 
 
 
 
177
  if (void 0 === a) {
178
  var a = { site_url: document.location.origin, defaulted: !0, ajax_url: document.location.origin + "/wp-admin?admin-ajax.php" };
179
  }
8
 
9
  function mailchimpGetCurrentUserByHash(a) {
10
  try {
11
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
12
  var b = mailchimp_public_data.ajax_url + "?action=mailchimp_get_user_by_hash&hash=" + a, c = new XMLHttpRequest;
13
  c.open("POST", b, !0), c.onload = function () {
14
  if (c.status >= 200 && c.status < 400) {
29
  }
30
  function mailchimpHandleBillingEmail(selector) {
31
  try {
32
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
33
  if (!selector) selector = "#billing_email";
34
  var a = document.querySelector(selector);
35
  var b = void 0 !== a ? a.value : "";
69
  this.previous_email = null;
70
  this.expireUser = function () {
71
  this.current_email = null;
72
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
73
  mailchimp.storage.expire("mailchimp.cart.current_email");
74
  };
75
  this.expireSaved = function () {
76
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
77
  mailchimp.storage.expire("mailchimp.cart.items");
78
  };
79
  this.setEmail = function (a) {
80
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
81
  if (!this.valueEmail(a)) return false;
82
  this.setPreviousEmail(this.getEmail());
83
  mailchimp.storage.set("mailchimp.cart.current_email", this.current_email = a);
84
  };
85
  this.getEmail = function () {
86
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
87
  if (this.current_email) return this.current_email;
88
  var a = mailchimp.storage.get("mailchimp.cart.current_email", !1);
89
  if (!a || !this.valueEmail(a)) return false;
90
  return this.current_email = a;
91
  };
92
  this.setPreviousEmail = function (a) {
93
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
94
  if (!this.valueEmail(a)) return false;
95
  mailchimp.storage.set("mailchimp.cart.previous_email", this.previous_email = a);
96
  };
181
 
182
  mailchimpReady(function () {
183
 
184
+ // if they've told us we can't do this - we have to honor it.
185
+ if (!mailchimp_public_data.allowed_to_set_cookies) return;
186
+
187
  if (void 0 === a) {
188
  var a = { site_url: document.location.origin, defaulted: !0, ajax_url: document.location.origin + "/wp-admin?admin-ajax.php" };
189
  }