MailChimp for WooCommerce - Version 2.3.6

Version Description

  • fix for Audience Defaults and Settings not visible
  • improved campaign tracking on external payment gateways and API endpoints
  • fix for transactionals being subscribed after force resync
Download this release

Release Info

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

Code changes from version 2.3.5 to 2.3.6

README.txt CHANGED
@@ -3,8 +3,8 @@ 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.3.2
7
- Stable tag: 2.3.5
8
  Requires PHP: 7.0
9
  WC requires at least: 3.5
10
  WC tested up to: 4.0
@@ -63,12 +63,15 @@ The Mailchimp for WooCommerce supports Wordpress Multi Sites and below are a few
63
  - Deleting removes the connection between Mailchimp and WooCommerce, and uninstalls the plugin from your site.
64
  Refer to the Wordpress Codex for more information about [Multisite Network Administration](https://codex.wordpress.org/Multisite_Network_Administration)
65
  == Changelog ==
 
 
 
 
66
  = 2.3.5 =
67
  * updates to Action Scheduler
68
  * create new audience option
69
  * fixes small oauth screen layout
70
  * number format on sync stats
71
- * fix campaign tracking cookie
72
  * update readme description
73
  = 2.3.4 =
74
  * updates to Action Scheduler
3
  Tags: ecommerce,email,workflows,mailchimp
4
  Donate link: https://mailchimp.com
5
  Requires at least: 4.9
6
+ Tested up to: 5.4
7
+ Stable tag: 2.3.6
8
  Requires PHP: 7.0
9
  WC requires at least: 3.5
10
  WC tested up to: 4.0
63
  - Deleting removes the connection between Mailchimp and WooCommerce, and uninstalls the plugin from your site.
64
  Refer to the Wordpress Codex for more information about [Multisite Network Administration](https://codex.wordpress.org/Multisite_Network_Administration)
65
  == Changelog ==
66
+ = 2.3.6 =
67
+ * fix for Audience Defaults and Settings not visible
68
+ * improved campaign tracking on external payment gateways and API endpoints
69
+ * fix for transactionals being subscribed after force resync
70
  = 2.3.5 =
71
  * updates to Action Scheduler
72
  * create new audience option
73
  * fixes small oauth screen layout
74
  * number format on sync stats
 
75
  * update readme description
76
  = 2.3.4 =
77
  * updates to Action Scheduler
admin/class-mailchimp-woocommerce-admin.php CHANGED
@@ -241,6 +241,13 @@ class MailChimp_WooCommerce_Admin extends MailChimp_WooCommerce_Options {
241
  if (version_compare($version, $saved_version) > 0) {
242
  // resave the site option so this only fires once.
243
  update_site_option('mailchimp_woocommerce_version', $version);
 
 
 
 
 
 
 
244
  }
245
 
246
  if (!get_option( $this->plugin_name.'_cart_table_add_index_update')) {
@@ -267,7 +274,7 @@ class MailChimp_WooCommerce_Admin extends MailChimp_WooCommerce_Options {
267
  update_option( $this->plugin_name.'_woo_currency_update', true);
268
  }
269
  }
270
-
271
  if($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}mailchimp_jobs';") != $wpdb->prefix.'mailchimp_jobs') {
272
  MailChimp_WooCommerce_Activator::create_queue_tables();
273
  MailChimp_WooCommerce_Activator::migrate_jobs();
@@ -638,7 +645,7 @@ class MailChimp_WooCommerce_Admin extends MailChimp_WooCommerce_Options {
638
  $data['ip_address'] = '127.0.0.1';
639
  }
640
  else {
641
- $data['ip_address'] = isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
642
  }
643
 
644
  $pload = array(
@@ -892,7 +899,7 @@ class MailChimp_WooCommerce_Admin extends MailChimp_WooCommerce_Options {
892
  $data = array(
893
  'mailchimp_list' => isset($input['mailchimp_list']) ? $input['mailchimp_list'] : $this->getOption('mailchimp_list', ''),
894
  'newsletter_label' => (isset($input['newsletter_label']) && $input['newsletter_label'] != '') ? wp_kses($input['newsletter_label'], $allowed_html) : $this->getOption('newsletter_label', __('Subscribe to our newsletter', 'mailchimp-for-woocommerce')),
895
- 'mailchimp_auto_subscribe' => isset($input['mailchimp_auto_subscribe']) ? (bool) $input['mailchimp_auto_subscribe'] : $this->getOption('mailchimp_auto_subscribe', '0'),
896
  'mailchimp_checkbox_defaults' => $checkbox,
897
  'mailchimp_checkbox_action' => isset($input['mailchimp_checkbox_action']) ? $input['mailchimp_checkbox_action'] : $this->getOption('mailchimp_checkbox_action', 'woocommerce_after_checkout_billing_form'),
898
  'mailchimp_user_tags' => isset($input['mailchimp_user_tags']) ? implode(",",$sanitized_tags) : $this->getOption('mailchimp_user_tags'),
241
  if (version_compare($version, $saved_version) > 0) {
242
  // resave the site option so this only fires once.
243
  update_site_option('mailchimp_woocommerce_version', $version);
244
+
245
+ $options = $this->getOptions();
246
+
247
+ if (!isset($options['mailchimp_permission_cap']) || empty($options['mailchimp_permission_cap']) ) {
248
+ $options['mailchimp_permission_cap'] = 'manage_options';
249
+ update_option($this->plugin_name, $options);
250
+ }
251
  }
252
 
253
  if (!get_option( $this->plugin_name.'_cart_table_add_index_update')) {
274
  update_option( $this->plugin_name.'_woo_currency_update', true);
275
  }
276
  }
277
+
278
  if($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}mailchimp_jobs';") != $wpdb->prefix.'mailchimp_jobs') {
279
  MailChimp_WooCommerce_Activator::create_queue_tables();
280
  MailChimp_WooCommerce_Activator::migrate_jobs();
645
  $data['ip_address'] = '127.0.0.1';
646
  }
647
  else {
648
+ $data['ip_address'] = isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']);
649
  }
650
 
651
  $pload = array(
899
  $data = array(
900
  'mailchimp_list' => isset($input['mailchimp_list']) ? $input['mailchimp_list'] : $this->getOption('mailchimp_list', ''),
901
  'newsletter_label' => (isset($input['newsletter_label']) && $input['newsletter_label'] != '') ? wp_kses($input['newsletter_label'], $allowed_html) : $this->getOption('newsletter_label', __('Subscribe to our newsletter', 'mailchimp-for-woocommerce')),
902
+ 'mailchimp_auto_subscribe' => isset($input['mailchimp_auto_subscribe']) ? (bool) $input['mailchimp_auto_subscribe'] : false,
903
  'mailchimp_checkbox_defaults' => $checkbox,
904
  'mailchimp_checkbox_action' => isset($input['mailchimp_checkbox_action']) ? $input['mailchimp_checkbox_action'] : $this->getOption('mailchimp_checkbox_action', 'woocommerce_after_checkout_billing_form'),
905
  'mailchimp_user_tags' => isset($input['mailchimp_user_tags']) ? implode(",",$sanitized_tags) : $this->getOption('mailchimp_user_tags'),
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.3.5',
91
  'php_version' => phpversion(),
92
  'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version),
93
  'wc_version' => function_exists('WC') ? WC()->version : null,
@@ -1040,13 +1040,12 @@ function mailchimp_update_member_with_double_opt_in(MailChimp_WooCommerce_Order
1040
  }
1041
  }
1042
 
1043
-
1044
  // call server to update comm status
1045
  function mailchimp_update_communication_status() {
1046
  $plugin_admin = MailChimp_WooCommerce_Admin::instance();
1047
  $original_opt = $plugin_admin->getData('comm.opt',0);
1048
  $admin_email = $plugin_admin->getOptions()['admin_email'];
1049
-
1050
  $plugin_admin->mailchimp_set_communications_status_on_server($original_opt, $admin_email);
1051
 
1052
  }
@@ -1057,7 +1056,7 @@ function mailchimp_remove_communication_status() {
1057
  $original_opt = $plugin_admin->getData('comm.opt',0);
1058
  $admin_email = $plugin_admin->getOptions()['admin_email'];
1059
  $remove = true;
1060
-
1061
  $plugin_admin->mailchimp_set_communications_status_on_server($original_opt, $admin_email, $remove);
1062
  }
1063
 
@@ -1066,7 +1065,7 @@ function mailchimp_settings_errors() {
1066
  $settings_errors = get_settings_errors();
1067
  $notices_html = '';
1068
  foreach ($settings_errors as $notices) {
1069
- $notices_html .= '<div id="setting-error-'. $notices['code'].'" class="notice notice-'. $notices['type'].' inline is-dismissible"><p>' . $notices['message'] . '</p></div>';
1070
  }
1071
  return $notices_html;
1072
  }
87
  return (object) array(
88
  'repo' => 'master',
89
  'environment' => 'production', // staging or production
90
+ 'version' => '2.3.6',
91
  'php_version' => phpversion(),
92
  'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version),
93
  'wc_version' => function_exists('WC') ? WC()->version : null,
1040
  }
1041
  }
1042
 
 
1043
  // call server to update comm status
1044
  function mailchimp_update_communication_status() {
1045
  $plugin_admin = MailChimp_WooCommerce_Admin::instance();
1046
  $original_opt = $plugin_admin->getData('comm.opt',0);
1047
  $admin_email = $plugin_admin->getOptions()['admin_email'];
1048
+
1049
  $plugin_admin->mailchimp_set_communications_status_on_server($original_opt, $admin_email);
1050
 
1051
  }
1056
  $original_opt = $plugin_admin->getData('comm.opt',0);
1057
  $admin_email = $plugin_admin->getOptions()['admin_email'];
1058
  $remove = true;
1059
+
1060
  $plugin_admin->mailchimp_set_communications_status_on_server($original_opt, $admin_email, $remove);
1061
  }
1062
 
1065
  $settings_errors = get_settings_errors();
1066
  $notices_html = '';
1067
  foreach ($settings_errors as $notices) {
1068
+ $notices_html .= '<div id="setting-error-'. $notices['code'].'" class="notice notice-'. $notices['type'].' inline is-dismissible"><p>' . $notices['message'] . '</p></div>';
1069
  }
1070
  return $notices_html;
1071
  }
composer.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "require-dev": {
3
+ "phpcompatibility/php-compatibility": "*",
4
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.6",
5
+ "phpcompatibility/phpcompatibility-wp": "^2.1"
6
+ },
7
+ "prefer-stable" : true
8
+ }
composer.lock ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "d11e6aae1eaec02cef06dea2cbbeb891",
8
+ "packages": [],
9
+ "packages-dev": [
10
+ {
11
+ "name": "dealerdirect/phpcodesniffer-composer-installer",
12
+ "version": "v0.6.2",
13
+ "source": {
14
+ "type": "git",
15
+ "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
16
+ "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a"
17
+ },
18
+ "dist": {
19
+ "type": "zip",
20
+ "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/8001af8eb107fbfcedc31a8b51e20b07d85b457a",
21
+ "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a",
22
+ "shasum": ""
23
+ },
24
+ "require": {
25
+ "composer-plugin-api": "^1.0",
26
+ "php": "^5.3|^7",
27
+ "squizlabs/php_codesniffer": "^2|^3"
28
+ },
29
+ "require-dev": {
30
+ "composer/composer": "*",
31
+ "phpcompatibility/php-compatibility": "^9.0",
32
+ "sensiolabs/security-checker": "^4.1.0"
33
+ },
34
+ "type": "composer-plugin",
35
+ "extra": {
36
+ "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
37
+ },
38
+ "autoload": {
39
+ "psr-4": {
40
+ "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
41
+ }
42
+ },
43
+ "notification-url": "https://packagist.org/downloads/",
44
+ "license": [
45
+ "MIT"
46
+ ],
47
+ "authors": [
48
+ {
49
+ "name": "Franck Nijhof",
50
+ "email": "franck.nijhof@dealerdirect.com",
51
+ "homepage": "http://www.frenck.nl",
52
+ "role": "Developer / IT Manager"
53
+ }
54
+ ],
55
+ "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
56
+ "homepage": "http://www.dealerdirect.com",
57
+ "keywords": [
58
+ "PHPCodeSniffer",
59
+ "PHP_CodeSniffer",
60
+ "code quality",
61
+ "codesniffer",
62
+ "composer",
63
+ "installer",
64
+ "phpcs",
65
+ "plugin",
66
+ "qa",
67
+ "quality",
68
+ "standard",
69
+ "standards",
70
+ "style guide",
71
+ "stylecheck",
72
+ "tests"
73
+ ],
74
+ "time": "2020-01-29T20:22:20+00:00"
75
+ },
76
+ {
77
+ "name": "phpcompatibility/php-compatibility",
78
+ "version": "9.3.5",
79
+ "source": {
80
+ "type": "git",
81
+ "url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
82
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
83
+ },
84
+ "dist": {
85
+ "type": "zip",
86
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
87
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
88
+ "shasum": ""
89
+ },
90
+ "require": {
91
+ "php": ">=5.3",
92
+ "squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
93
+ },
94
+ "conflict": {
95
+ "squizlabs/php_codesniffer": "2.6.2"
96
+ },
97
+ "require-dev": {
98
+ "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
99
+ },
100
+ "suggest": {
101
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
102
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
103
+ },
104
+ "type": "phpcodesniffer-standard",
105
+ "notification-url": "https://packagist.org/downloads/",
106
+ "license": [
107
+ "LGPL-3.0-or-later"
108
+ ],
109
+ "authors": [
110
+ {
111
+ "name": "Wim Godden",
112
+ "homepage": "https://github.com/wimg",
113
+ "role": "lead"
114
+ },
115
+ {
116
+ "name": "Juliette Reinders Folmer",
117
+ "homepage": "https://github.com/jrfnl",
118
+ "role": "lead"
119
+ },
120
+ {
121
+ "name": "Contributors",
122
+ "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
123
+ }
124
+ ],
125
+ "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
126
+ "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
127
+ "keywords": [
128
+ "compatibility",
129
+ "phpcs",
130
+ "standards"
131
+ ],
132
+ "time": "2019-12-27T09:44:58+00:00"
133
+ },
134
+ {
135
+ "name": "phpcompatibility/phpcompatibility-paragonie",
136
+ "version": "1.3.0",
137
+ "source": {
138
+ "type": "git",
139
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
140
+ "reference": "b862bc32f7e860d0b164b199bd995e690b4b191c"
141
+ },
142
+ "dist": {
143
+ "type": "zip",
144
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/b862bc32f7e860d0b164b199bd995e690b4b191c",
145
+ "reference": "b862bc32f7e860d0b164b199bd995e690b4b191c",
146
+ "shasum": ""
147
+ },
148
+ "require": {
149
+ "phpcompatibility/php-compatibility": "^9.0"
150
+ },
151
+ "require-dev": {
152
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5",
153
+ "paragonie/random_compat": "dev-master",
154
+ "paragonie/sodium_compat": "dev-master"
155
+ },
156
+ "suggest": {
157
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
158
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
159
+ },
160
+ "type": "phpcodesniffer-standard",
161
+ "notification-url": "https://packagist.org/downloads/",
162
+ "license": [
163
+ "LGPL-3.0-or-later"
164
+ ],
165
+ "authors": [
166
+ {
167
+ "name": "Wim Godden",
168
+ "role": "lead"
169
+ },
170
+ {
171
+ "name": "Juliette Reinders Folmer",
172
+ "role": "lead"
173
+ }
174
+ ],
175
+ "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
176
+ "homepage": "http://phpcompatibility.com/",
177
+ "keywords": [
178
+ "compatibility",
179
+ "paragonie",
180
+ "phpcs",
181
+ "polyfill",
182
+ "standards"
183
+ ],
184
+ "time": "2019-11-04T15:17:54+00:00"
185
+ },
186
+ {
187
+ "name": "phpcompatibility/phpcompatibility-wp",
188
+ "version": "2.1.0",
189
+ "source": {
190
+ "type": "git",
191
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
192
+ "reference": "41bef18ba688af638b7310666db28e1ea9158b2f"
193
+ },
194
+ "dist": {
195
+ "type": "zip",
196
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/41bef18ba688af638b7310666db28e1ea9158b2f",
197
+ "reference": "41bef18ba688af638b7310666db28e1ea9158b2f",
198
+ "shasum": ""
199
+ },
200
+ "require": {
201
+ "phpcompatibility/php-compatibility": "^9.0",
202
+ "phpcompatibility/phpcompatibility-paragonie": "^1.0"
203
+ },
204
+ "require-dev": {
205
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5"
206
+ },
207
+ "suggest": {
208
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
209
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
210
+ },
211
+ "type": "phpcodesniffer-standard",
212
+ "notification-url": "https://packagist.org/downloads/",
213
+ "license": [
214
+ "LGPL-3.0-or-later"
215
+ ],
216
+ "authors": [
217
+ {
218
+ "name": "Wim Godden",
219
+ "role": "lead"
220
+ },
221
+ {
222
+ "name": "Juliette Reinders Folmer",
223
+ "role": "lead"
224
+ }
225
+ ],
226
+ "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
227
+ "homepage": "http://phpcompatibility.com/",
228
+ "keywords": [
229
+ "compatibility",
230
+ "phpcs",
231
+ "standards",
232
+ "wordpress"
233
+ ],
234
+ "time": "2019-08-28T14:22:28+00:00"
235
+ },
236
+ {
237
+ "name": "squizlabs/php_codesniffer",
238
+ "version": "3.5.4",
239
+ "source": {
240
+ "type": "git",
241
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
242
+ "reference": "dceec07328401de6211037abbb18bda423677e26"
243
+ },
244
+ "dist": {
245
+ "type": "zip",
246
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26",
247
+ "reference": "dceec07328401de6211037abbb18bda423677e26",
248
+ "shasum": ""
249
+ },
250
+ "require": {
251
+ "ext-simplexml": "*",
252
+ "ext-tokenizer": "*",
253
+ "ext-xmlwriter": "*",
254
+ "php": ">=5.4.0"
255
+ },
256
+ "require-dev": {
257
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
258
+ },
259
+ "bin": [
260
+ "bin/phpcs",
261
+ "bin/phpcbf"
262
+ ],
263
+ "type": "library",
264
+ "extra": {
265
+ "branch-alias": {
266
+ "dev-master": "3.x-dev"
267
+ }
268
+ },
269
+ "notification-url": "https://packagist.org/downloads/",
270
+ "license": [
271
+ "BSD-3-Clause"
272
+ ],
273
+ "authors": [
274
+ {
275
+ "name": "Greg Sherwood",
276
+ "role": "lead"
277
+ }
278
+ ],
279
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
280
+ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
281
+ "keywords": [
282
+ "phpcs",
283
+ "standards"
284
+ ],
285
+ "time": "2020-01-30T22:20:29+00:00"
286
+ }
287
+ ],
288
+ "aliases": [],
289
+ "minimum-stability": "stable",
290
+ "stability-flags": [],
291
+ "prefer-stable": true,
292
+ "prefer-lowest": false,
293
+ "platform": [],
294
+ "platform-dev": []
295
+ }
includes/class-mailchimp-woocommerce-service.php CHANGED
@@ -87,9 +87,17 @@ class MailChimp_Service extends MailChimp_WooCommerce_Options
87
 
88
  // see if we have a session id and a campaign id, also only do this when this user is not the admin.
89
  $campaign_id = $this->getCampaignTrackingID();
 
 
 
 
90
 
91
  // grab the landing site cookie if we have one here.
92
  $landing_site = $this->getLandingSiteCookie();
 
 
 
 
93
 
94
  // expire the landing site cookie so we can rinse and repeat tracking
95
  $this->expireLandingSiteCookie();
@@ -114,7 +122,7 @@ class MailChimp_Service extends MailChimp_WooCommerce_Options
114
  $tracking = null;
115
  $newOrder = false;
116
 
117
- if ("pending" == $old_status && "processing" == $new_status) {
118
  $tracking = $this->onNewOrder($order_id);
119
  $newOrder = true;
120
  }
@@ -136,6 +144,12 @@ class MailChimp_Service extends MailChimp_WooCommerce_Options
136
  $campaign_id = isset($tracking) && isset($tracking['campaign_id']) ? $tracking['campaign_id'] : null;
137
  $landing_site = isset($tracking) && isset($tracking['landing_site']) ? $tracking['landing_site'] : null;
138
 
 
 
 
 
 
 
139
  $handler = new MailChimp_WooCommerce_Single_Order($order_id, null, $campaign_id, $landing_site);
140
  $handler->is_update = $newOrder ? !$newOrder : null;
141
  $handler->is_admin_save = is_admin();
@@ -272,7 +286,8 @@ class MailChimp_Service extends MailChimp_WooCommerce_Options
272
  if ('product' == $post->post_type) {
273
  mailchimp_handle_or_queue(new MailChimp_WooCommerce_Single_Product($post_id), 5);
274
  } elseif ('shop_order' == $post->post_type) {
275
- $this->onOrderSave($post_id);
 
276
  }
277
  }
278
  }
87
 
88
  // see if we have a session id and a campaign id, also only do this when this user is not the admin.
89
  $campaign_id = $this->getCampaignTrackingID();
90
+ if (empty($campaign_id)) {
91
+ $campaign_id = get_post_meta($order_id, 'mailchimp_woocommerce_campaign_id', true);
92
+ if (!$campaign_id) $campaign = null;
93
+ }
94
 
95
  // grab the landing site cookie if we have one here.
96
  $landing_site = $this->getLandingSiteCookie();
97
+ if (empty($landing_site)) {
98
+ $landing_site = get_post_meta($order_id, 'mailchimp_woocommerce_landing_site', true);
99
+ if (!$landing_site) $campaign = null;
100
+ }
101
 
102
  // expire the landing site cookie so we can rinse and repeat tracking
103
  $this->expireLandingSiteCookie();
122
  $tracking = null;
123
  $newOrder = false;
124
 
125
+ if ("pending" == $old_status && ("processing" == $new_status || "completed" == $new_status)) {
126
  $tracking = $this->onNewOrder($order_id);
127
  $newOrder = true;
128
  }
144
  $campaign_id = isset($tracking) && isset($tracking['campaign_id']) ? $tracking['campaign_id'] : null;
145
  $landing_site = isset($tracking) && isset($tracking['landing_site']) ? $tracking['landing_site'] : null;
146
 
147
+ if (isset($tracking)) {
148
+ // update the post meta with campaing tracking details for future sync
149
+ update_post_meta($order_id, 'mailchimp_woocommerce_campaign_id', $campaign_id);
150
+ update_post_meta($order_id, 'mailchimp_woocommerce_landing_site', $landing_site);
151
+ }
152
+
153
  $handler = new MailChimp_WooCommerce_Single_Order($order_id, null, $campaign_id, $landing_site);
154
  $handler->is_update = $newOrder ? !$newOrder : null;
155
  $handler->is_admin_save = is_admin();
286
  if ('product' == $post->post_type) {
287
  mailchimp_handle_or_queue(new MailChimp_WooCommerce_Single_Product($post_id), 5);
288
  } elseif ('shop_order' == $post->post_type) {
289
+ $tracking = $this->onNewOrder($post_id);
290
+ $this->onOrderSave($post_id, $tracking, !$update);
291
  }
292
  }
293
  }
includes/processes/class-mailchimp-woocommerce-process-orders.php CHANGED
@@ -42,14 +42,17 @@ class MailChimp_WooCommerce_Process_Orders extends MailChimp_WooCommerce_Abstrac
42
  }
43
 
44
  // see if this store has the auto subscribe setting enabled on initial sync
45
- $should_auto_subscribe = (bool) $this->getOption('mailchimp_auto_subscribe', true);
46
 
47
  // since we're syncing the customer for the first time, this is where we need to add the override
48
  // for subscriber status. We don't get the checkbox until this plugin is actually installed and working!
49
  if (!($status = $item->getCustomer()->getOptInStatus())) {
50
  try {
51
  $subscriber = $this->mailchimp()->member(mailchimp_get_list_id(), $item->getCustomer()->getEmailAddress());
52
- $status = !in_array($subscriber['status'], array('unsubscribed', 'transactional'));
 
 
 
53
  } catch (\Exception $e) {
54
  if ($e instanceof MailChimp_WooCommerce_RateLimitError) {
55
  mailchimp_error('order_sync.error', mailchimp_error_trace($e, "GET subscriber :: {$item->getId()}"));
@@ -57,10 +60,10 @@ class MailChimp_WooCommerce_Process_Orders extends MailChimp_WooCommerce_Abstrac
57
  }
58
  // if they are using double opt in, we need to pass this in as false here so it doesn't auto subscribe.
59
  $status = mailchimp_list_has_double_optin() ? false : $should_auto_subscribe;
 
60
  }
61
- $item->getCustomer()->setOptInStatus($status);
62
  }
63
-
64
  try {
65
  $type = $this->mailchimp()->getStoreOrder($this->store_id, $item->getId(), true) ? 'update' : 'create';
66
  } catch (MailChimp_WooCommerce_Error $e) {
42
  }
43
 
44
  // see if this store has the auto subscribe setting enabled on initial sync
45
+ $should_auto_subscribe = (bool) $this->getOption('mailchimp_auto_subscribe', false);
46
 
47
  // since we're syncing the customer for the first time, this is where we need to add the override
48
  // for subscriber status. We don't get the checkbox until this plugin is actually installed and working!
49
  if (!($status = $item->getCustomer()->getOptInStatus())) {
50
  try {
51
  $subscriber = $this->mailchimp()->member(mailchimp_get_list_id(), $item->getCustomer()->getEmailAddress());
52
+ if ($subscriber['status'] != 'archived') {
53
+ $status = !in_array($subscriber['status'], array('unsubscribed', 'transactional'));
54
+ $item->getCustomer()->setOptInStatus($status);
55
+ }
56
  } catch (\Exception $e) {
57
  if ($e instanceof MailChimp_WooCommerce_RateLimitError) {
58
  mailchimp_error('order_sync.error', mailchimp_error_trace($e, "GET subscriber :: {$item->getId()}"));
60
  }
61
  // if they are using double opt in, we need to pass this in as false here so it doesn't auto subscribe.
62
  $status = mailchimp_list_has_double_optin() ? false : $should_auto_subscribe;
63
+ $item->getCustomer()->setOptInStatus($status);
64
  }
 
65
  }
66
+
67
  try {
68
  $type = $this->mailchimp()->getStoreOrder($this->store_id, $item->getId(), true) ? 'update' : 'create';
69
  } catch (MailChimp_WooCommerce_Error $e) {
includes/processes/class-mailchimp-woocommerce-single-order.php CHANGED
@@ -226,7 +226,7 @@ class MailChimp_WooCommerce_Single_Order extends Mailchimp_Woocommerce_Job
226
  return $api_response;
227
  }
228
 
229
- if ($deleted_abandoned_cart) {
230
  $log .= " :: abandoned cart deleted [{$this->cart_session_id}]";
231
  }
232
 
226
  return $api_response;
227
  }
228
 
229
+ if (isset($deleted_abandoned_cart) && $deleted_abandoned_cart) {
230
  $log .= " :: abandoned cart deleted [{$this->cart_session_id}]";
231
  }
232
 
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.3.5
20
  * Author: Mailchimp
21
  * Author URI: https://mailchimp.com
22
  * License: GPL-2.0+
@@ -24,7 +24,7 @@
24
  * Text Domain: mailchimp-for-woocommerce
25
  * Domain Path: /languages
26
  * Requires at least: 4.9
27
- * Tested up to: 5.3.2
28
  * WC requires at least: 3.5
29
  * WC tested up to: 4.0
30
  */
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.3.6
20
  * Author: Mailchimp
21
  * Author URI: https://mailchimp.com
22
  * License: GPL-2.0+
24
  * Text Domain: mailchimp-for-woocommerce
25
  * Domain Path: /languages
26
  * Requires at least: 4.9
27
+ * Tested up to: 5.4
28
  * WC requires at least: 3.5
29
  * WC tested up to: 4.0
30
  */