WooCommerce MailChimp - Version 2.4.6

Version Description

Download this release

Release Info

Developer anderly
Plugin Icon 128x128 WooCommerce MailChimp
Version 2.4.6
Comparing to
See all releases

Code changes from version 2.4.5 to 2.4.6

includes/class-ss-wc-mailchimp-api.php CHANGED
@@ -193,7 +193,7 @@ class SS_WC_MailChimp_API {
193
 
194
  $error = json_decode( $json, true );
195
 
196
- $this->last_error = new WP_Error( 'ss-wc-mc-api-request-error', $error['detail'], $this->format_error( $resource, $method, $raw_response ) );
197
 
198
  $this->maybe_log( $url, $method, $args, $raw_response );
199
 
@@ -252,6 +252,23 @@ class SS_WC_MailChimp_API {
252
  );
253
  }
254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  /**
256
  * has_api_key function.
257
  *
193
 
194
  $error = json_decode( $json, true );
195
 
196
+ $this->last_error = new WP_Error( 'ss-wc-mc-api-request-error', $error['detail'] . $this->concat_errors( $error ), $this->format_error( $resource, $method, $raw_response ) );
197
 
198
  $this->maybe_log( $url, $method, $args, $raw_response );
199
 
252
  );
253
  }
254
 
255
+ /**
256
+ * Concatenates Mailchimp API errors array into string.
257
+ * @param array $error
258
+ * @return string String representation of the concatenated Mailchimp API errors.
259
+ */
260
+ private function concat_errors( $error ) {
261
+
262
+ if ( !is_array( $error ) || !is_array( $error['errors'] ) ) {
263
+ return '';
264
+ }
265
+
266
+ $fields = array_map(function($err) {
267
+ return '{ field: ' . $err['field'] . ', message: ' . $err['message'] . ' }';
268
+ }, $error['errors'] );
269
+ return ' (' . implode( ', ', $fields ) . ')';
270
+ }
271
+
272
  /**
273
  * has_api_key function.
274
  *
includes/class-ss-wc-mailchimp-plugin.php CHANGED
@@ -15,7 +15,7 @@ final class SS_WC_MailChimp_Plugin {
15
  *
16
  * @var string
17
  */
18
- private static $version = '2.4.5';
19
 
20
  /**
21
  * Plugin singleton instance
15
  *
16
  * @var string
17
  */
18
+ private static $version = '2.4.6';
19
 
20
  /**
21
  * Plugin singleton instance
readme.txt CHANGED
@@ -6,7 +6,7 @@ Requires at least: 4.7.0
6
  Tested up to: 5.8.1
7
  WC tested up to: 5.7.1
8
  Requires PHP: 5.6
9
- Stable tag: 2.4.5
10
  License: GPLv3
11
 
12
  Simple and flexible Mailchimp integration for WooCommerce.
@@ -119,6 +119,9 @@ Also, if you enjoy using the software [we'd love it if you could give us a revie
119
 
120
  == Changelog ==
121
 
 
 
 
122
  #### 2.4.5 - Oct 5, 2021
123
  - Only send merge fields if not empty.
124
  - Bump WC tested version up to 5.7.1.
6
  Tested up to: 5.8.1
7
  WC tested up to: 5.7.1
8
  Requires PHP: 5.6
9
+ Stable tag: 2.4.6
10
  License: GPLv3
11
 
12
  Simple and flexible Mailchimp integration for WooCommerce.
119
 
120
  == Changelog ==
121
 
122
+ #### 2.4.6 - Oct 5, 2021
123
+ - Enhance error logging.
124
+
125
  #### 2.4.5 - Oct 5, 2021
126
  - Only send merge fields if not empty.
127
  - Bump WC tested version up to 5.7.1.
woocommerce-mailchimp.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: WP WooCommerce Mailchimp provides simple and flexible Mailchimp integration for WooCommerce.
6
  * Author: Saint Systems
7
  * Author URI: https://www.saintsystems.com
8
- * Version: 2.4.5
9
  * WC tested up to: 5.7.1
10
  * Text Domain: woocommerce-mailchimp
11
  * Domain Path: languages
5
  * Description: WP WooCommerce Mailchimp provides simple and flexible Mailchimp integration for WooCommerce.
6
  * Author: Saint Systems
7
  * Author URI: https://www.saintsystems.com
8
+ * Version: 2.4.6
9
  * WC tested up to: 5.7.1
10
  * Text Domain: woocommerce-mailchimp
11
  * Domain Path: languages