Skip to content

Commit

Permalink
Merge pull request #1122 from mailchimp/3.7
Browse files Browse the repository at this point in the history
3.7
  • Loading branch information
ryanhungate authored Mar 6, 2024
2 parents 1ee6b19 + 8e2796e commit 961ae41
Show file tree
Hide file tree
Showing 19 changed files with 1,075 additions and 1,721 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
== Changelog ==
= 3.7 =
* Allow orders to be sent to Mailchimp even if a Wordpress user role isn't set
* Support for custom order IDs
* Updated dependabot issues related to block-based checkouts
= 3.6 =
* Add support for product image size changes
* Add sync filter for order post types
Expand Down
17 changes: 7 additions & 10 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Contributors: ryanhungate, Mailchimp
Tags: ecommerce,email,workflows,mailchimp
Donate link: https://mailchimp.com
Requires at least: 4.9
Tested up to: 6.4
Stable tag: 3.6
Tested up to: 6.5
Stable tag: 3.7
Requires PHP: 7.4
WC requires at least: 4.2
WC tested up to: 8.5
WC tested up to: 8.7
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Connect your store to your Mailchimp audience to track sales, create targeted emails, send abandoned cart emails, and more.
Expand Down Expand Up @@ -78,10 +78,7 @@ At this time, the synchronization of product categories from WooCommerce to Mail
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.

== Changelog ==
= 3.6 =
* Add support for product image size changes
* Add sync filter for order post types
* Fix for double order issue w/ Woo subscription plugin
* Support for changing variable products to simple products
* Enhancement in Webhook handling due to permalink structures

= 3.7 =
* Allow orders to be sent to Mailchimp even if a Wordpress user role isn't set
* Support for custom order IDs
* Updated dependabot issues related to block-based checkouts
24 changes: 9 additions & 15 deletions admin/class-mailchimp-woocommerce-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -641,13 +641,11 @@ public function mailchimp_update_woo_settings() {

// sync the store with MC
try {
$store_created = $this->syncStore( $data );
return $this->syncStore( $data );
} catch ( Exception $e ) {
mailchimp_log( 'store.sync@woo.update', 'Store cannot be synced', $e->getMessage() );
return false;
}

return $store_created;
}

/**
Expand Down Expand Up @@ -1285,7 +1283,7 @@ protected function validatePostNewsletterSettings( $input ) {
'campaign_from_name' => isset( $input['campaign_from_name'] ) ? $input['campaign_from_name'] : false,
'campaign_from_email' => isset( $input['campaign_from_email'] ) && is_email( $input['campaign_from_email'] ) ? $input['campaign_from_email'] : false,
'campaign_subject' => isset( $input['campaign_subject'] ) ? $input['campaign_subject'] : get_option( 'blogname' ),
'campaign_language' => isset( $input['campaign_language'] ) ? $input['campaign_language'] : 'en',
'campaign_language' => isset( $input['campaign_language'] ) ? $input['campaign_language'] : $this->getOption( 'store_locale' , 'en'),
'campaign_permission_reminder' => isset( $input['campaign_permission_reminder'] ) ? $input['campaign_permission_reminder'] : sprintf( /* translators: %s - plugin name. */esc_html__( 'You were subscribed to the newsletter from %s', 'mailchimp-for-woocommerce' ), get_option( 'blogname' ) ),
);

Expand Down Expand Up @@ -1314,7 +1312,7 @@ protected function validatePostNewsletterSettings( $input ) {

// sync the store with MC
try {
$store_created = $this->syncStore( array_merge( $this->getOptions(), $data ) );
$store_created = $this->syncStore( array_merge( $this->getOptions(), $data ), true );
} catch ( Exception $e ) {
$this->setData( 'validation.newsletter_settings', false );
mailchimp_log( 'errors.newsletter_settings', 'Store cannot be synced :: ' . $e->getMessage() );
Expand Down Expand Up @@ -1760,14 +1758,14 @@ private function updateMailChimpList( $data = null, $list_id = null ) {

/**
* @param null $data
*
* @param bool $update_campaign_defaults
* @return bool
* @throws Exception
* @throws MailChimp_WooCommerce_Error
* @throws MailChimp_WooCommerce_RateLimitError
* @throws MailChimp_WooCommerce_ServerError
*/
public function syncStore( $data = null ) {
public function syncStore( $data = null, $update_campaign_defaults = false ) {
if ( empty( $data ) ) {
$data = $this->getOptions();
}
Expand Down Expand Up @@ -1811,13 +1809,7 @@ public function syncStore( $data = null ) {
$store->setListId( $list_id );

try {
mailchimp_log(
'sync_store',
'posting data',
array(
'store_post' => $store->toArray(),
)
);
mailchimp_log('sync_store', 'posting data', array('store_post' => $store->toArray()));

// let's create a new store for this user through the API
$this->api()->$call( $store, false );
Expand All @@ -1830,7 +1822,9 @@ public function syncStore( $data = null ) {
mailchimp_update_connected_site_script();

// we need to update the list again with the campaign defaults
$this->updateMailChimpList( $data, $list_id );
if (!$update_campaign_defaults) {
$this->updateMailChimpList( $data, $list_id );
}

return true;
} catch ( Exception $e ) {
Expand Down
2 changes: 1 addition & 1 deletion blocks/build/newsletter-block-frontend.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wc-blocks-checkout', 'wc-blocks-shared-hocs', 'wc-settings', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '6c38ea938266abe7c582');
<?php return array('dependencies' => array('react', 'wc-blocks-checkout', 'wc-blocks-shared-hocs', 'wc-settings', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '9928316618b9da0d4020');
2 changes: 1 addition & 1 deletion blocks/build/newsletter-block-frontend.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion blocks/build/newsletter-block.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wc-blocks-checkout', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '1cac73b423b8e8027e1b');
<?php return array('dependencies' => array('react', 'wc-blocks-checkout', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n', 'wp-polyfill'), 'version' => '8aad4d0233a59d33bfd0');
Loading

0 comments on commit 961ae41

Please sign in to comment.