From ad4ab65a08809c551b72f4466c63464faf9ed2b8 Mon Sep 17 00:00:00 2001 From: tarassych Date: Wed, 16 Aug 2023 12:47:31 +0300 Subject: [PATCH 1/3] added WPML support to sync correct urls for the product --- .../api/class-mailchimp-woocommerce-transform-products.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/api/class-mailchimp-woocommerce-transform-products.php b/includes/api/class-mailchimp-woocommerce-transform-products.php index 00a55d34..dc38ca73 100644 --- a/includes/api/class-mailchimp-woocommerce-transform-products.php +++ b/includes/api/class-mailchimp-woocommerce-transform-products.php @@ -81,6 +81,12 @@ public function transform( $woo, $fallback_title = null ) { $product = new MailChimp_WooCommerce_Product(); + if ( class_exists( 'SitePress' ) && function_exists( 'wpml_switch_language_action' ) ) { + $get_language_args = array( 'element_id' => $woo->get_id(), 'element_type' => 'product' ); + $post_language_info = apply_filters( 'wpml_element_language_details', null, $get_language_args ); + wpml_switch_language_action( $post_language_info->language_code ); + } + $product->setId( $woo->get_id() ); $product->setHandle( $woo->get_slug() ); $product->setImageUrl( $this->getProductImage( $woo ) ); From 56901811a35c82aa537a1253de7bb2ff6a87e9a0 Mon Sep 17 00:00:00 2001 From: Ryan Hungate Date: Thu, 17 Aug 2023 14:56:38 -0400 Subject: [PATCH 2/3] version bump (meta only) --- bootstrap.php | 2 +- mailchimp-woocommerce.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap.php b/bootstrap.php index 4c7dd711..df9f2dcd 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -97,7 +97,7 @@ function mailchimp_environment_variables() { return (object) array( 'repo' => 'master', 'environment' => 'production', // staging or production - 'version' => '3.2', + 'version' => '3.3', 'php_version' => phpversion(), 'wp_version' => (empty($wp_version) ? 'Unknown' : $wp_version), 'wc_version' => function_exists('WC') ? WC()->version : null, diff --git a/mailchimp-woocommerce.php b/mailchimp-woocommerce.php index 8e7c2d44..cdb4cece 100644 --- a/mailchimp-woocommerce.php +++ b/mailchimp-woocommerce.php @@ -16,7 +16,7 @@ * Plugin Name: Mailchimp for WooCommerce * Plugin URI: https://mailchimp.com/connect-your-store/ * Description: Connects WooCommerce to Mailchimp to sync your store data, send targeted campaigns to your customers, and sell more stuff. - * Version: 3.2 + * Version: 3.3 * Author: Mailchimp * Author URI: https://mailchimp.com * License: GPL-2.0+ From 3ef5b79e5d8236dcc314e199fce14cab9e68edd6 Mon Sep 17 00:00:00 2001 From: tarassych Date: Fri, 25 Aug 2023 11:21:43 +0300 Subject: [PATCH 3/3] Added urldecoded product url and handle for support Cyrillic --- .../api/class-mailchimp-woocommerce-transform-products.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/api/class-mailchimp-woocommerce-transform-products.php b/includes/api/class-mailchimp-woocommerce-transform-products.php index dc38ca73..40396f08 100644 --- a/includes/api/class-mailchimp-woocommerce-transform-products.php +++ b/includes/api/class-mailchimp-woocommerce-transform-products.php @@ -88,12 +88,12 @@ public function transform( $woo, $fallback_title = null ) { } $product->setId( $woo->get_id() ); - $product->setHandle( $woo->get_slug() ); + $product->setHandle( urldecode($woo->get_slug() ) ); $product->setImageUrl( $this->getProductImage( $woo ) ); $product->setDescription( $woo->get_description() ); $product->setPublishedAtForeign( mailchimp_date_utc( $woo->get_date_created() ) ); $product->setTitle( $woo->get_title() ); - $product->setUrl( $woo->get_permalink() ); + $product->setUrl( urldecode( $woo->get_permalink() ) ); $original_vendor = ''; if ( in_array( 'woocommerce-product-vendors/woocommerce-product-vendors.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) || defined( 'WC_PRODUCT_VENDORS_VERSION' ) ) { @@ -159,7 +159,7 @@ public function variant( $post, $fallback_title = null ) { } $variant->setId( $woo->get_id() ); - $variant->setUrl( $woo->get_permalink() ); + $variant->setUrl( urldecode( $woo->get_permalink() ) ); $variant->setImageUrl( $this->getProductImage( $post ) ); $variant->setPrice( $woo->get_price() ); $variant->setSku( $woo->get_sku() );