WooCommerce MailChimp - Version 1.3

Version Description

  • Breaking Change: 'ss_wc_mailchimp_subscribe_merge_vars' action filter now passes $order_id param to enable retrieving additional order info/meta to use in MailChimp merge vars
  • Small fix to order_created subscribe event to work with PayPal Payment Gateway
Download this release

Release Info

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

Code changes from version 1.2.6 to 1.3

README.md CHANGED
@@ -64,6 +64,10 @@ If you need help, have problems, want to leave feedback or want to provide const
64
 
65
  ### Changelog
66
 
 
 
 
 
67
  #### 1.2.6
68
  * Added additional debug logging when WP_DEBUG is enabled
69
 
64
 
65
  ### Changelog
66
 
67
+ #### 1.3
68
+ * Breaking Change: 'ss_wc_mailchimp_subscribe_merge_vars' action filter now passes $order_id param to enable retrieving additional order info/meta to use in MailChimp merge vars
69
+ * Small fix to order_created subscribe event to work with PayPal Payment Gateway
70
+
71
  #### 1.2.6
72
  * Added additional debug logging when WP_DEBUG is enabled
73
 
classes/class-ss-wc-integration-mailchimp.php CHANGED
@@ -9,7 +9,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
  *
10
  * @class SS_WC_Integration_MailChimp
11
  * @extends WC_Integration
12
- * @version 1.2.6
13
  * @package WooCommerce MailChimp
14
  * @author Saint Systems
15
  */
@@ -57,8 +57,8 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
57
  add_action( 'woocommerce_update_options_integration_' . $this->id, array( $this, 'process_admin_options') );
58
 
59
  // We would use the 'woocommerce_new_order' action but first name, last name and email address (order meta) is not yet available,
60
- // so instead we use the 'woocommerce_thankyou' action hook which fires after the checkout process on the "thank you" page
61
- add_action( 'woocommerce_thankyou', array( &$this, 'order_status_changed' ), 10, 1 );
62
 
63
  // hook into woocommerce order status changed hook to handle the desired subscription event trigger
64
  add_action( 'woocommerce_order_status_changed', array( &$this, 'order_status_changed' ), 10, 3 );
@@ -110,7 +110,7 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
110
  // If the 'ss_wc_mailchimp_opt_in' meta value isn't set (because 'display_opt_in' wasn't enabled at the time the order was placed) or the 'ss_wc_mailchimp_opt_in' is yes, subscriber the customer
111
  if ( ! isset( $ss_wc_mailchimp_opt_in ) || empty( $ss_wc_mailchimp_opt_in ) || 'yes' == $ss_wc_mailchimp_opt_in ) {
112
  self::log( 'Subscribing user (' . $order->billing_email . ') to list(' . $this->list . ') ' );
113
- $this->subscribe( $order->billing_first_name, $order->billing_last_name, $order->billing_email, $this->list );
114
  }
115
 
116
  }
@@ -367,13 +367,14 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
367
  * subscribe function.
368
  *
369
  * @access public
 
370
  * @param mixed $first_name
371
  * @param mixed $last_name
372
  * @param mixed $email
373
  * @param string $listid (default: 'false')
374
  * @return void
375
  */
376
- public function subscribe( $first_name, $last_name, $email, $listid = 'false' ) {
377
 
378
  if ( ! $email )
379
  return; // Email is required
@@ -391,7 +392,7 @@ class SS_WC_Integration_MailChimp extends WC_Integration {
391
  );
392
  }
393
 
394
- $vars = apply_filters( 'ss_wc_mailchimp_subscribe_merge_vars', $merge_vars );
395
 
396
  $email_type = 'html';
397
  $double_optin = ( $this->double_optin == 'no' ? false : true );
9
  *
10
  * @class SS_WC_Integration_MailChimp
11
  * @extends WC_Integration
12
+ * @version 1.3
13
  * @package WooCommerce MailChimp
14
  * @author Saint Systems
15
  */
57
  add_action( 'woocommerce_update_options_integration_' . $this->id, array( $this, 'process_admin_options') );
58
 
59
  // We would use the 'woocommerce_new_order' action but first name, last name and email address (order meta) is not yet available,
60
+ // so instead we use the 'woocommerce_checkout_update_order_meta' action hook which fires after the checkout process on the "thank you" page
61
+ add_action( 'woocommerce_checkout_update_order_meta', array( &$this, 'order_status_changed' ), 1000, 1 );
62
 
63
  // hook into woocommerce order status changed hook to handle the desired subscription event trigger
64
  add_action( 'woocommerce_order_status_changed', array( &$this, 'order_status_changed' ), 10, 3 );
110
  // If the 'ss_wc_mailchimp_opt_in' meta value isn't set (because 'display_opt_in' wasn't enabled at the time the order was placed) or the 'ss_wc_mailchimp_opt_in' is yes, subscriber the customer
111
  if ( ! isset( $ss_wc_mailchimp_opt_in ) || empty( $ss_wc_mailchimp_opt_in ) || 'yes' == $ss_wc_mailchimp_opt_in ) {
112
  self::log( 'Subscribing user (' . $order->billing_email . ') to list(' . $this->list . ') ' );
113
+ $this->subscribe( $id, $order->billing_first_name, $order->billing_last_name, $order->billing_email, $this->list );
114
  }
115
 
116
  }
367
  * subscribe function.
368
  *
369
  * @access public
370
+ * @param int $order_id
371
  * @param mixed $first_name
372
  * @param mixed $last_name
373
  * @param mixed $email
374
  * @param string $listid (default: 'false')
375
  * @return void
376
  */
377
+ public function subscribe( $order_id, $first_name, $last_name, $email, $listid = 'false' ) {
378
 
379
  if ( ! $email )
380
  return; // Email is required
392
  );
393
  }
394
 
395
+ $vars = apply_filters( 'ss_wc_mailchimp_subscribe_merge_vars', $order_id, $merge_vars );
396
 
397
  $email_type = 'html';
398
  $double_optin = ( $this->double_optin == 'no' ? false : true );
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === WooCommerce MailChimp ===
2
  Contributors: anderly, saintsystems
3
  Tags: woocommerce, mailchimp
4
- Requires at least: 3.6
5
  Tested up to: 3.8.1
6
- Stable tag: 1.2.6
7
  License: GPLv3
8
 
9
  Simple and flexible MailChimp integration for WooCommerce.
@@ -78,6 +78,10 @@ If you need help, have problems, want to leave feedback or want to provide const
78
 
79
  == Changelog ==
80
 
 
 
 
 
81
  = 1.2.6 =
82
  * Added additional debug logging when WP_DEBUG is enabled
83
 
1
  === WooCommerce MailChimp ===
2
  Contributors: anderly, saintsystems
3
  Tags: woocommerce, mailchimp
4
+ Requires at least: 3.5.1
5
  Tested up to: 3.8.1
6
+ Stable tag: 1.3
7
  License: GPLv3
8
 
9
  Simple and flexible MailChimp integration for WooCommerce.
78
 
79
  == Changelog ==
80
 
81
+ = 1.3 =
82
+ * Breaking Change: 'ss_wc_mailchimp_subscribe_merge_vars' action filter now passes $order_id param to enable retrieving additional order info/meta to use in MailChimp merge vars
83
+ * Small fix to order_created subscribe event to work with PayPal Payment Gateway
84
+
85
  = 1.2.6 =
86
  * Added additional debug logging when WP_DEBUG is enabled
87
 
woocommerce-mailchimp.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: WooCommerce MailChimp provides simple MailChimp integration for WooCommerce.
6
  * Author: Adam Anderly
7
  * Author URI: http://anderly.com
8
- * Version: 1.2.6
9
  * Text Domain: ss_wc_mailchimp
10
  * Domain Path: languages
11
  *
5
  * Description: WooCommerce MailChimp provides simple MailChimp integration for WooCommerce.
6
  * Author: Adam Anderly
7
  * Author URI: http://anderly.com
8
+ * Version: 1.3
9
  * Text Domain: ss_wc_mailchimp
10
  * Domain Path: languages
11
  *