WooCommerce Multilingual – run WooCommerce with WPML - Version 4.6.2.1

Version Description

  • Fix performance issues with WooCommerce 3.6.*
Download this release

Release Info

Developer sergey.r
Plugin Icon 128x128 WooCommerce Multilingual – run WooCommerce with WPML
Version 4.6.2.1
Comparing to
See all releases

Code changes from version 4.6.2 to 4.6.2.1

changelog/4.4.0.md CHANGED
@@ -41,4 +41,5 @@
41
  * [wcml-2539] Added support for wpml endpoints
42
  * [wcml-2538] WP Fastest Cache compatibility - fixed currency switcher problem
43
  * [wcml-2532] Added ability to set custom prices for secondary currencies in WC Product Add-Ons
44
- * [wcml-2201] Update minimum requirements
 
41
  * [wcml-2539] Added support for wpml endpoints
42
  * [wcml-2538] WP Fastest Cache compatibility - fixed currency switcher problem
43
  * [wcml-2532] Added ability to set custom prices for secondary currencies in WC Product Add-Ons
44
+ * [wcml-2201] Update minimum requirements
45
+ * [wcml-2011] Added ability to add custom payment methods for each currency
changelog/4.6.2.1.md ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ # Fixes
2
+ * [wcml-2783] -
3
+ * [wcml-2782] Fix performance issues with WooCommerce 3.6.*
inc/class-wcml-products.php CHANGED
@@ -671,51 +671,46 @@ class WCML_Products{
671
  return $value;
672
  }
673
 
674
-
675
  public function filter_product_data( $data, $product_id, $meta_key ) {
676
 
677
- if ( ! $meta_key && in_array( get_post_type( $product_id ), array( 'product', 'product_variation' ) ) ) {
678
- remove_filter( 'get_post_metadata', array( $this, 'filter_product_data' ), 10 );
679
 
680
- $data = get_post_meta( $product_id );
681
 
682
- $is_mc_enabled = (int) $this->woocommerce_wpml->settings['enable_multi_currency'] === (int) $this->sitepress->get_wp_api()->constant( 'WCML_MULTI_CURRENCIES_INDEPENDENT' );
683
 
684
- $price_keys = array();
685
- if ( $is_mc_enabled ) {
686
- $price_keys = wcml_price_custom_fields( $product_id );
687
- }
688
 
689
- $is_original_product = $this->woocommerce_wpml->products->is_original_product( $product_id );
690
- if( is_product() && !$is_original_product ){
691
- $data['_product_image_gallery'] = null;
692
- }
 
 
 
 
693
 
694
- foreach ( $data as $meta_key => $meta_value ) {
695
-
696
- $filtered_value = false;
697
- $meta_value = $meta_value ? $meta_value[0] : null;
698
-
699
- if ( $is_mc_enabled && in_array( $meta_key, $price_keys, true ) ) {
700
- $filtered_value = $this->woocommerce_wpml->multi_currency->prices->product_price_filter( $meta_value, $product_id, $meta_key, true );
701
- } elseif ( ! is_admin() ) {
702
- if ( in_array( $meta_key, array( '_wc_review_count', '_wc_average_rating' ), true ) ) {
703
- $filtered_value = $this->woocommerce_wpml->comments->filter_average_rating( $meta_value, $product_id, $meta_key, true );
704
- } elseif ( '_product_image_gallery' === $meta_key && ! $is_original_product ) {
705
- $factory = new WCML_Product_Gallery_Filter_Factory();
706
- $filtered_value = $factory->create()->localize_image_ids( $meta_value, $product_id, $meta_key );
707
- } elseif ( '_thumbnail_id' === $meta_key && ! $is_original_product ) {
708
- $factory = new WCML_Product_Image_Filter_Factory();
709
- $filtered_value = $factory->create()->localize_image_id( $meta_value, $product_id, $meta_key );
710
  }
711
  }
712
 
713
- if ( $filtered_value ) {
714
- $data[ $meta_key ][0] = $filtered_value;
715
  }
716
- }
717
 
718
- add_filter( 'get_post_metadata', array( $this, 'filter_product_data' ), 10, 3 );
 
719
  }
720
 
721
  return $data;
671
  return $value;
672
  }
673
 
 
674
  public function filter_product_data( $data, $product_id, $meta_key ) {
675
 
676
+ if ( ! $meta_key ) {
 
677
 
678
+ $post_type = get_post_type( $product_id );
679
 
680
+ if ( in_array( $post_type, array( 'product', 'product_variation' ), true ) ) {
681
 
682
+ remove_filter( 'get_post_metadata', array( $this, 'filter_product_data' ), 10 );
 
 
 
683
 
684
+ $data = get_post_meta( $product_id );
685
+
686
+ $meta_keys_to_filter = array();
687
+ $is_mc_enabled = (int) $this->woocommerce_wpml->settings['enable_multi_currency'] === (int) $this->sitepress->get_wp_api()->constant( 'WCML_MULTI_CURRENCIES_INDEPENDENT' );
688
+
689
+ if ( $is_mc_enabled ) {
690
+ $meta_keys_to_filter = wcml_price_custom_fields( $product_id );
691
+ }
692
 
693
+ if ( ! is_admin() ) {
694
+ if ( 'product' === $post_type ) {
695
+ $meta_keys_to_filter[] = '_wc_review_count';
696
+ $meta_keys_to_filter[] = '_wc_average_rating';
697
+ }
698
+
699
+ $is_original_product = $this->woocommerce_wpml->products->is_original_product( $product_id );
700
+ if ( ! $is_original_product ) {
701
+ $meta_keys_to_filter[] = '_thumbnail_id';
702
+ if ( 'product' === $post_type && is_product() ) {
703
+ $meta_keys_to_filter[] = '_product_image_gallery';
704
+ }
 
 
 
 
705
  }
706
  }
707
 
708
+ foreach ( $meta_keys_to_filter as $meta_key ) {
709
+ $data[ $meta_key ][0] = get_post_meta( $product_id, $meta_key, true );
710
  }
 
711
 
712
+ add_filter( 'get_post_metadata', array( $this, 'filter_product_data' ), 10, 3 );
713
+ }
714
  }
715
 
716
  return $data;
inc/currencies/class-wcml-multi-currency-orders.php CHANGED
@@ -6,15 +6,12 @@ class WCML_Multi_Currency_Orders {
6
  private $multi_currency;
7
  /** @var woocommerce_wpml */
8
  private $woocommerce_wpml;
9
- /** @var WPML_WP_API $wp_api */
10
- private $wp_api;
11
  /** @var WP $wp */
12
  private $wp;
13
 
14
- public function __construct( WCML_Multi_Currency $multi_currency, woocommerce_wpml $woocommerce_wpml, WPML_WP_API $wp_api, WP $wp ) {
15
  $this->multi_currency = $multi_currency;
16
  $this->woocommerce_wpml = $woocommerce_wpml;
17
- $this->wp_api = $wp_api;
18
  $this->wp = $wp;
19
 
20
  if ( is_admin() ) {
@@ -39,9 +36,7 @@ class WCML_Multi_Currency_Orders {
39
  add_action( 'woocommerce_process_shop_order_meta', array( $this, 'set_order_currency_on_update' ), 10, 2 );
40
  add_action( 'woocommerce_order_actions_start', array( $this, 'show_order_currency_selector' ) );
41
 
42
- if( $this->wp_api->version_compare( $this->wp_api->constant( 'WC_VERSION' ), '3.6.0', '<' ) ){
43
- add_filter( 'woocommerce_order_get_items', array( $this, 'set_totals_for_order_items' ), 10, 2 );
44
- }
45
 
46
  add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'add_woocommerce_hidden_order_itemmeta' ) );
47
 
6
  private $multi_currency;
7
  /** @var woocommerce_wpml */
8
  private $woocommerce_wpml;
 
 
9
  /** @var WP $wp */
10
  private $wp;
11
 
12
+ public function __construct( WCML_Multi_Currency $multi_currency, woocommerce_wpml $woocommerce_wpml, WP $wp ) {
13
  $this->multi_currency = $multi_currency;
14
  $this->woocommerce_wpml = $woocommerce_wpml;
 
15
  $this->wp = $wp;
16
 
17
  if ( is_admin() ) {
36
  add_action( 'woocommerce_process_shop_order_meta', array( $this, 'set_order_currency_on_update' ), 10, 2 );
37
  add_action( 'woocommerce_order_actions_start', array( $this, 'show_order_currency_selector' ) );
38
 
39
+ add_filter( 'woocommerce_order_get_items', array( $this, 'set_totals_for_order_items' ), 10, 2 );
 
 
40
 
41
  add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'add_woocommerce_hidden_order_itemmeta' ) );
42
 
inc/currencies/class-wcml-multi-currency.php CHANGED
@@ -116,7 +116,7 @@ class WCML_Multi_Currency{
116
  }
117
  $this->reports = new WCML_Multi_Currency_Reports( $woocommerce_wpml, $sitepress, $wpdb );
118
  $this->reports->add_hooks();
119
- $this->orders = new WCML_Multi_Currency_Orders( $this, $woocommerce_wpml, $sitepress->get_wp_api(), $wp );
120
  $this->admin_currency_selector = new WCML_Admin_Currency_Selector(
121
  $woocommerce_wpml,
122
  new WCML_Admin_Cookie( '_wcml_dashboard_currency' )
@@ -169,7 +169,8 @@ class WCML_Multi_Currency{
169
  'woocommerce_add_to_cart',
170
  'woocommerce_update_shipping_method',
171
  'woocommerce_json_search_products_and_variations',
172
- 'woocommerce_add_coupon_discount'
 
173
  )
174
  );
175
 
116
  }
117
  $this->reports = new WCML_Multi_Currency_Reports( $woocommerce_wpml, $sitepress, $wpdb );
118
  $this->reports->add_hooks();
119
+ $this->orders = new WCML_Multi_Currency_Orders( $this, $woocommerce_wpml, $wp );
120
  $this->admin_currency_selector = new WCML_Admin_Currency_Selector(
121
  $woocommerce_wpml,
122
  new WCML_Admin_Cookie( '_wcml_dashboard_currency' )
169
  'woocommerce_add_to_cart',
170
  'woocommerce_update_shipping_method',
171
  'woocommerce_json_search_products_and_variations',
172
+ 'woocommerce_add_coupon_discount',
173
+
174
  )
175
  );
176
 
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: http://wpml.org/documentation/related-projects/woocommerce-multilin
4
  Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
5
  License: GPLv2
6
  Requires at least: 4.7
7
- Tested up to: 5.1.1
8
- Stable tag: 4.6.2
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
@@ -140,6 +140,9 @@ WooCommerce Multilingual is compatible with all major WooCommerce extensions. We
140
 
141
  == Changelog ==
142
 
 
 
 
143
  = 4.6.2 =
144
  * Fix performance issue while saving product
145
  * Fix warning when _wc_rating_cout value is corrupted
@@ -243,6 +246,7 @@ WooCommerce Multilingual is compatible with all major WooCommerce extensions. We
243
  * WP Fastest Cache compatibility - fixed currency switcher problem
244
  * Added ability to set custom prices for secondary currencies in WC Product Add-Ons
245
  * Update minimum requirements
 
246
 
247
  = 4.3.7 =
248
  * Fixed issue which was changing the current language of the site when saving an order
4
  Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
5
  License: GPLv2
6
  Requires at least: 4.7
7
+ Tested up to: 5.2
8
+ Stable tag: 4.6.2.1
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
140
 
141
  == Changelog ==
142
 
143
+ = 4.6.2.1 =
144
+ * Fix performance issues with WooCommerce 3.6.*
145
+
146
  = 4.6.2 =
147
  * Fix performance issue while saving product
148
  * Fix warning when _wc_rating_cout value is corrupted
246
  * WP Fastest Cache compatibility - fixed currency switcher problem
247
  * Added ability to set custom prices for secondary currencies in WC Product Add-Ons
248
  * Update minimum requirements
249
+ * Added ability to add custom payment methods for each currency
250
 
251
  = 4.3.7 =
252
  * Fixed issue which was changing the current language of the site when saving an order
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitaebef6501751b2ca9149e46af77ba3f6::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit0cec763d74f74b23be3d1b2c4d68ab88::getLoader();
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInitad18820a95101f9a22ae65b5f71a3b54::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInitb2ca1656ba10a612c5e45d5e0a7ce3d6::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitaebef6501751b2ca9149e46af77ba3f6
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitaebef6501751b2ca9149e46af77ba3f6
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitaebef6501751b2ca9149e46af77ba3f6', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitaebef6501751b2ca9149e46af77ba3f6', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInitaebef6501751b2ca9149e46af77ba3f6::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInitaebef6501751b2ca9149e46af77ba3f6
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInitaebef6501751b2ca9149e46af77ba3f6::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequireaebef6501751b2ca9149e46af77ba3f6($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequireaebef6501751b2ca9149e46af77ba3f6($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit0cec763d74f74b23be3d1b2c4d68ab88
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit0cec763d74f74b23be3d1b2c4d68ab88', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit0cec763d74f74b23be3d1b2c4d68ab88', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit0cec763d74f74b23be3d1b2c4d68ab88::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit0cec763d74f74b23be3d1b2c4d68ab88::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire0cec763d74f74b23be3d1b2c4d68ab88($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire0cec763d74f74b23be3d1b2c4d68ab88($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInitad18820a95101f9a22ae65b5f71a3b54 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitad18820a95101f9a22ae65b5f71a3b54 {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitad18820a95101f9a22ae65b5f71a3b54', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitad18820a95101f9a22ae65b5f71a3b54', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInitb2ca1656ba10a612c5e45d5e0a7ce3d6 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitb2ca1656ba10a612c5e45d5e0a7ce3d6', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitb2ca1656ba10a612c5e45d5e0a7ce3d6', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitaebef6501751b2ca9149e46af77ba3f6
8
  {
9
  public static $files = array (
10
  'b45b351e6b6f7487d819961fef2fda77' => __DIR__ . '/..' . '/jakeasmith/http_build_url/src/http_build_url.php',
@@ -242,10 +242,10 @@ class ComposerStaticInitaebef6501751b2ca9149e46af77ba3f6
242
  public static function getInitializer(ClassLoader $loader)
243
  {
244
  return \Closure::bind(function () use ($loader) {
245
- $loader->prefixLengthsPsr4 = ComposerStaticInitaebef6501751b2ca9149e46af77ba3f6::$prefixLengthsPsr4;
246
- $loader->prefixDirsPsr4 = ComposerStaticInitaebef6501751b2ca9149e46af77ba3f6::$prefixDirsPsr4;
247
- $loader->prefixesPsr0 = ComposerStaticInitaebef6501751b2ca9149e46af77ba3f6::$prefixesPsr0;
248
- $loader->classMap = ComposerStaticInitaebef6501751b2ca9149e46af77ba3f6::$classMap;
249
 
250
  }, null, ClassLoader::class);
251
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit0cec763d74f74b23be3d1b2c4d68ab88
8
  {
9
  public static $files = array (
10
  'b45b351e6b6f7487d819961fef2fda77' => __DIR__ . '/..' . '/jakeasmith/http_build_url/src/http_build_url.php',
242
  public static function getInitializer(ClassLoader $loader)
243
  {
244
  return \Closure::bind(function () use ($loader) {
245
+ $loader->prefixLengthsPsr4 = ComposerStaticInit0cec763d74f74b23be3d1b2c4d68ab88::$prefixLengthsPsr4;
246
+ $loader->prefixDirsPsr4 = ComposerStaticInit0cec763d74f74b23be3d1b2c4d68ab88::$prefixDirsPsr4;
247
+ $loader->prefixesPsr0 = ComposerStaticInit0cec763d74f74b23be3d1b2c4d68ab88::$prefixesPsr0;
248
+ $loader->classMap = ComposerStaticInit0cec763d74f74b23be3d1b2c4d68ab88::$classMap;
249
 
250
  }, null, ClassLoader::class);
251
  }
wpml-woocommerce.php CHANGED
@@ -7,8 +7,8 @@
7
  Author URI: http://www.onthegosystems.com/
8
  Text Domain: woocommerce-multilingual
9
  Requires at least: 4.7
10
- Tested up to: 5.1.1
11
- Version: 4.6.2
12
  WC requires at least: 3.3.0
13
  WC tested up to: 3.6.2
14
  */
@@ -17,7 +17,7 @@ if ( defined( 'WCML_VERSION' ) ) {
17
  return;
18
  }
19
 
20
- define( 'WCML_VERSION', '4.6.2' );
21
  define( 'WCML_PLUGIN_PATH', dirname( __FILE__ ) );
22
  define( 'WCML_PLUGIN_FOLDER', basename( WCML_PLUGIN_PATH ) );
23
  define( 'WCML_LOCALE_PATH', WCML_PLUGIN_PATH . '/locale' );
7
  Author URI: http://www.onthegosystems.com/
8
  Text Domain: woocommerce-multilingual
9
  Requires at least: 4.7
10
+ Tested up to: 5.2
11
+ Version: 4.6.2.1
12
  WC requires at least: 3.3.0
13
  WC tested up to: 3.6.2
14
  */
17
  return;
18
  }
19
 
20
+ define( 'WCML_VERSION', '4.6.2.1' );
21
  define( 'WCML_PLUGIN_PATH', dirname( __FILE__ ) );
22
  define( 'WCML_PLUGIN_FOLDER', basename( WCML_PLUGIN_PATH ) );
23
  define( 'WCML_LOCALE_PATH', WCML_PLUGIN_PATH . '/locale' );