Version Description
- Fix wrong currency code after removing item from manually created order
- Replace *woocommerce_term_meta functions on *term_meta
- Fix gallery images not showing up on translated product page
- Fix double calculating order item price while manually adding it from admin to order with WooCommerce 3.6.0
- Fix performance issues on checkout with manage stock products
- Fix performance issue on shop page with WooCommerce 3.6
- Fix loading scripts on admin pages
- Fix coupon discount when editing order from admin
- Fix wrong product price after adding another product to existing order from admin
- Fix my-account page endpoints in secondary language with pages set to "Display as translated"
Download this release
Release Info
Developer | sergey.r |
Plugin | WooCommerce Multilingual – run WooCommerce with WPML |
Version | 4.6.0 |
Comparing to | |
See all releases |
Code changes from version 4.5.0 to 4.6.0
- changelog/4.6.0.md +11 -0
- classes/class-woocommerce-wpml.php +2 -1
- classes/media/class-wcml-product-image-filter.php +1 -1
- inc/class-wcml-endpoints.php +9 -14
- inc/class-wcml-products.php +9 -4
- inc/class-wcml-resources.php +35 -28
- inc/class-wcml-terms.php +8 -8
- inc/class-wcml-troubleshooting.php +4 -4
- inc/currencies/class-wcml-multi-currency-orders.php +120 -90
- inc/currencies/class-wcml-multi-currency-prices.php +1 -0
- inc/currencies/class-wcml-multi-currency.php +2 -2
- inc/translation-editor/class-wcml-synchronize-product-data.php +28 -7
- readme.txt +15 -3
- vendor/autoload.php +1 -1
- vendor/autoload_52.php +1 -1
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_real_52.php +3 -3
- vendor/composer/autoload_static.php +5 -5
- wpml-woocommerce.php +4 -4
changelog/4.6.0.md
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Fixes
|
2 |
+
* [wcml-2772] Fix wrong currency code after removing item from manually created order
|
3 |
+
* [wcml-2769] Replace *_woocommerce_term_meta functions on *_term_meta
|
4 |
+
* [wcml-2768] Fix gallery images not showing up on translated product page
|
5 |
+
* [wcml-2766] Fix double calculating order item price while manually adding it from admin to order with WooCommerce 3.6.0
|
6 |
+
* [wcml-2764] Fix performance issues on checkout with manage stock products
|
7 |
+
* [wcml-2763] Fix performance issue on shop page with WooCommerce 3.6
|
8 |
+
* [wcml-2755] Fix loading scripts on admin pages
|
9 |
+
* [wcml-2754] Fix coupon discount when editing order from admin
|
10 |
+
* [wcml-2726] Fix wrong product price after adding another product to existing order from admin
|
11 |
+
* [wcml-2653] Fix my-account page endpoints in secondary language with pages set to "Display as translated"
|
classes/class-woocommerce-wpml.php
CHANGED
@@ -247,7 +247,8 @@ class woocommerce_wpml {
|
|
247 |
$wcml_ajax_setup->add_hooks();
|
248 |
WCML_Install::initialize( $this, $sitepress );
|
249 |
|
250 |
-
|
|
|
251 |
|
252 |
$url_filters_redirect_location = new WCML_Url_Filters_Redirect_Location( $wpml_url_converter );
|
253 |
$url_filters_redirect_location->add_hooks();
|
247 |
$wcml_ajax_setup->add_hooks();
|
248 |
WCML_Install::initialize( $this, $sitepress );
|
249 |
|
250 |
+
WCML_Resources::set_up_resources( $this, $sitepress );
|
251 |
+
WCML_Resources::add_hooks();
|
252 |
|
253 |
$url_filters_redirect_location = new WCML_Url_Filters_Redirect_Location( $wpml_url_converter );
|
254 |
$url_filters_redirect_location->add_hooks();
|
classes/media/class-wcml-product-image-filter.php
CHANGED
@@ -17,7 +17,7 @@ class WCML_Product_Image_Filter implements IWPML_Action {
|
|
17 |
|
18 |
public function localize_image_id( $value, $object_id, $meta_key ) {
|
19 |
|
20 |
-
if ( '_thumbnail_id' === $meta_key &&
|
21 |
in_array( get_post_type( $object_id ), array( 'product', 'product_variation' ) ) &&
|
22 |
(
|
23 |
! defined( 'WPML_Admin_Post_Actions::DISPLAY_FEATURED_IMAGE_AS_TRANSLATED_META_KEY' ) ||
|
17 |
|
18 |
public function localize_image_id( $value, $object_id, $meta_key ) {
|
19 |
|
20 |
+
if ( !$value && '_thumbnail_id' === $meta_key &&
|
21 |
in_array( get_post_type( $object_id ), array( 'product', 'product_variation' ) ) &&
|
22 |
(
|
23 |
! defined( 'WPML_Admin_Post_Actions::DISPLAY_FEATURED_IMAGE_AS_TRANSLATED_META_KEY' ) ||
|
inc/class-wcml-endpoints.php
CHANGED
@@ -119,15 +119,8 @@ class WCML_Endpoints {
|
|
119 |
|
120 |
$found = null;
|
121 |
$reserved_requests = wp_cache_get( $cache_key, $cache_group, false, $found );
|
122 |
-
$is_page_display_as_translated = $this->sitepress->is_display_as_translated_post_type( 'page' );
|
123 |
|
124 |
-
if (
|
125 |
-
! $is_page_display_as_translated &&
|
126 |
-
(
|
127 |
-
! $found ||
|
128 |
-
! $reserved_requests
|
129 |
-
)
|
130 |
-
) {
|
131 |
$reserved_requests = array();
|
132 |
|
133 |
$current_language = $this->sitepress->get_current_language();
|
@@ -145,12 +138,14 @@ class WCML_Endpoints {
|
|
145 |
|
146 |
$reserved_requests[] = $account_base;
|
147 |
$reserved_requests[] = '/^' . $account_base . '/'; // regex version
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
$
|
152 |
-
|
153 |
-
|
|
|
|
|
154 |
}
|
155 |
}
|
156 |
}
|
119 |
|
120 |
$found = null;
|
121 |
$reserved_requests = wp_cache_get( $cache_key, $cache_group, false, $found );
|
|
|
122 |
|
123 |
+
if ( ! $found || ! $reserved_requests ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
$reserved_requests = array();
|
125 |
|
126 |
$current_language = $this->sitepress->get_current_language();
|
138 |
|
139 |
$reserved_requests[] = $account_base;
|
140 |
$reserved_requests[] = '/^' . $account_base . '/'; // regex version
|
141 |
+
$is_page_display_as_translated = $this->sitepress->is_display_as_translated_post_type( 'page' );
|
142 |
+
|
143 |
+
if( ! $is_page_display_as_translated ){
|
144 |
+
$wc_query_vars = $this->woocommerce_wpml->get_wc_query_vars();
|
145 |
+
foreach ( $wc_query_vars as $key => $endpoint ) {
|
146 |
+
$translated_endpoint = $this->get_endpoint_translation( $endpoint, $language_code );
|
147 |
+
$reserved_requests[] = $account_base . '/' . $translated_endpoint;
|
148 |
+
}
|
149 |
}
|
150 |
}
|
151 |
}
|
inc/class-wcml-products.php
CHANGED
@@ -685,20 +685,25 @@ class WCML_Products{
|
|
685 |
$price_keys = wcml_price_custom_fields( $product_id );
|
686 |
}
|
687 |
|
|
|
|
|
|
|
|
|
688 |
foreach ( $data as $meta_key => $meta_value ) {
|
689 |
|
690 |
$filtered_value = false;
|
|
|
691 |
|
692 |
if ( $is_mc_enabled && in_array( $meta_key, $price_keys, true ) ) {
|
693 |
-
$filtered_value = $this->woocommerce_wpml->multi_currency->prices->product_price_filter(
|
694 |
} elseif ( in_array( $meta_key, array( '_wc_review_count', '_wc_average_rating' ), true ) ) {
|
695 |
-
$filtered_value = $this->woocommerce_wpml->comments->filter_average_rating(
|
696 |
} elseif ( '_product_image_gallery' === $meta_key ) {
|
697 |
$factory = new WCML_Product_Gallery_Filter_Factory();
|
698 |
-
$filtered_value = $factory->create()->localize_image_ids(
|
699 |
} elseif ( '_thumbnail_id' === $meta_key ) {
|
700 |
$factory = new WCML_Product_Image_Filter_Factory();
|
701 |
-
$filtered_value = $factory->create()->localize_image_id(
|
702 |
}
|
703 |
|
704 |
if ( $filtered_value ) {
|
685 |
$price_keys = wcml_price_custom_fields( $product_id );
|
686 |
}
|
687 |
|
688 |
+
if( is_product() ){
|
689 |
+
$data['_product_image_gallery'] = null;
|
690 |
+
}
|
691 |
+
|
692 |
foreach ( $data as $meta_key => $meta_value ) {
|
693 |
|
694 |
$filtered_value = false;
|
695 |
+
$meta_value = $meta_value ? $meta_value[0] : null;
|
696 |
|
697 |
if ( $is_mc_enabled && in_array( $meta_key, $price_keys, true ) ) {
|
698 |
+
$filtered_value = $this->woocommerce_wpml->multi_currency->prices->product_price_filter( $meta_value, $product_id, $meta_key, true );
|
699 |
} elseif ( in_array( $meta_key, array( '_wc_review_count', '_wc_average_rating' ), true ) ) {
|
700 |
+
$filtered_value = $this->woocommerce_wpml->comments->filter_average_rating( $meta_value, $product_id, $meta_key, true );
|
701 |
} elseif ( '_product_image_gallery' === $meta_key ) {
|
702 |
$factory = new WCML_Product_Gallery_Filter_Factory();
|
703 |
+
$filtered_value = $factory->create()->localize_image_ids( $meta_value, $product_id, $meta_key );
|
704 |
} elseif ( '_thumbnail_id' === $meta_key ) {
|
705 |
$factory = new WCML_Product_Image_Filter_Factory();
|
706 |
+
$filtered_value = $factory->create()->localize_image_id( $meta_value, $product_id, $meta_key );
|
707 |
}
|
708 |
|
709 |
if ( $filtered_value ) {
|
inc/class-wcml-resources.php
CHANGED
@@ -10,7 +10,12 @@ class WCML_Resources {
|
|
10 |
private static $woocommerce_wpml;
|
11 |
private static $sitepress;
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
14 |
global $pagenow;
|
15 |
|
16 |
self::$woocommerce_wpml =& $woocommerce_wpml;
|
@@ -22,7 +27,6 @@ class WCML_Resources {
|
|
22 |
self::$pagenow = $pagenow;
|
23 |
|
24 |
self::load_css();
|
25 |
-
self::load_common_scripts();
|
26 |
|
27 |
$is_edit_product = self::$pagenow == 'post.php' && isset($_GET['post']) && get_post_type( $_GET['post'] ) == 'product';
|
28 |
$is_original_product = isset( $_GET['post'] ) && !is_array( $_GET['post'] ) && self::$woocommerce_wpml->products->is_original_product( $_GET['post'] );
|
@@ -84,7 +88,7 @@ class WCML_Resources {
|
|
84 |
wp_enqueue_script( 'wcml-taxonomy-translation-scripts' );
|
85 |
}
|
86 |
|
87 |
-
|
88 |
|
89 |
if ( self::$is_wpml_wcml_page ) {
|
90 |
|
@@ -151,32 +155,16 @@ class WCML_Resources {
|
|
151 |
wp_enqueue_script( 'custom-taxonomies' );
|
152 |
}
|
153 |
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
|
|
|
|
|
|
158 |
|
159 |
-
|
160 |
-
|
161 |
-
wp_register_script( 'cart-widget', WCML_PLUGIN_URL . '/res/js/cart_widget' . WCML_JS_MIN . '.js', array( 'jquery' ), WCML_VERSION, true );
|
162 |
-
wp_enqueue_script( 'cart-widget' );
|
163 |
-
wp_localize_script( 'cart-widget', 'actions', array(
|
164 |
-
'is_lang_switched' => self::$sitepress->get_language_from_url( $referer ) != self::$sitepress->get_current_language() ? 1 : 0,
|
165 |
-
'force_reset' => apply_filters( 'wcml_force_reset_cart_fragments', 0 )
|
166 |
-
) );
|
167 |
-
} elseif( is_admin() ) {
|
168 |
-
|
169 |
-
wp_enqueue_script(
|
170 |
-
'wcml-pointer',
|
171 |
-
WCML_PLUGIN_URL . '/res/js/pointer' . WCML_JS_MIN . '.js',
|
172 |
-
array( 'wp-pointer' ),
|
173 |
-
WCML_VERSION,
|
174 |
-
true
|
175 |
-
);
|
176 |
-
|
177 |
-
wp_register_script( 'wcml-messages', WCML_PLUGIN_URL . '/res/js/wcml-messages' . WCML_JS_MIN . '.js', array( 'jquery' ), WCML_VERSION, true );
|
178 |
-
wp_enqueue_script( 'wcml-messages' );
|
179 |
-
}
|
180 |
|
181 |
$is_attr_page = apply_filters( 'wcml_is_attributes_page', self::$page == 'product_attributes' && isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] == 'product' );
|
182 |
|
@@ -210,6 +198,25 @@ class WCML_Resources {
|
|
210 |
}
|
211 |
}
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
public static function load_tooltip_resources() {
|
214 |
|
215 |
if ( class_exists( 'WooCommerce' ) && function_exists( 'WC' ) ) {
|
10 |
private static $woocommerce_wpml;
|
11 |
private static $sitepress;
|
12 |
|
13 |
+
public static function add_hooks(){
|
14 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_scripts' ) );
|
15 |
+
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'front_scripts' ) );
|
16 |
+
}
|
17 |
+
|
18 |
+
public static function set_up_resources( &$woocommerce_wpml, &$sitepress ) {
|
19 |
global $pagenow;
|
20 |
|
21 |
self::$woocommerce_wpml =& $woocommerce_wpml;
|
27 |
self::$pagenow = $pagenow;
|
28 |
|
29 |
self::load_css();
|
|
|
30 |
|
31 |
$is_edit_product = self::$pagenow == 'post.php' && isset($_GET['post']) && get_post_type( $_GET['post'] ) == 'product';
|
32 |
$is_original_product = isset( $_GET['post'] ) && !is_array( $_GET['post'] ) && self::$woocommerce_wpml->products->is_original_product( $_GET['post'] );
|
88 |
wp_enqueue_script( 'wcml-taxonomy-translation-scripts' );
|
89 |
}
|
90 |
|
91 |
+
public static function admin_scripts() {
|
92 |
|
93 |
if ( self::$is_wpml_wcml_page ) {
|
94 |
|
155 |
wp_enqueue_script( 'custom-taxonomies' );
|
156 |
}
|
157 |
|
158 |
+
wp_enqueue_script(
|
159 |
+
'wcml-pointer',
|
160 |
+
WCML_PLUGIN_URL . '/res/js/pointer' . WCML_JS_MIN . '.js',
|
161 |
+
array( 'wp-pointer' ),
|
162 |
+
WCML_VERSION,
|
163 |
+
true
|
164 |
+
);
|
165 |
|
166 |
+
wp_register_script( 'wcml-messages', WCML_PLUGIN_URL . '/res/js/wcml-messages' . WCML_JS_MIN . '.js', array( 'jquery' ), WCML_VERSION, true );
|
167 |
+
wp_enqueue_script( 'wcml-messages' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
$is_attr_page = apply_filters( 'wcml_is_attributes_page', self::$page == 'product_attributes' && isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] == 'product' );
|
170 |
|
198 |
}
|
199 |
}
|
200 |
|
201 |
+
public static function front_scripts() {
|
202 |
+
|
203 |
+
if ( self::$pagenow != 'wp-login.php' ) {
|
204 |
+
|
205 |
+
wp_register_script( 'wcml-front-scripts', WCML_PLUGIN_URL . '/res/js/front-scripts' . WCML_JS_MIN . '.js', array( 'jquery' ), WCML_VERSION, true );
|
206 |
+
wp_enqueue_script( 'wcml-front-scripts' );
|
207 |
+
|
208 |
+
$referer = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '';
|
209 |
+
|
210 |
+
wp_register_script( 'cart-widget', WCML_PLUGIN_URL . '/res/js/cart_widget' . WCML_JS_MIN . '.js', array( 'jquery' ), WCML_VERSION, true );
|
211 |
+
wp_enqueue_script( 'cart-widget' );
|
212 |
+
wp_localize_script( 'cart-widget', 'actions', array(
|
213 |
+
'is_lang_switched' => self::$sitepress->get_language_from_url( $referer ) != self::$sitepress->get_current_language() ? 1 : 0,
|
214 |
+
'force_reset' => apply_filters( 'wcml_force_reset_cart_fragments', 0 )
|
215 |
+
) );
|
216 |
+
}
|
217 |
+
|
218 |
+
}
|
219 |
+
|
220 |
public static function load_tooltip_resources() {
|
221 |
|
222 |
if ( class_exists( 'WooCommerce' ) && function_exists( 'WC' ) ) {
|
inc/class-wcml-terms.php
CHANGED
@@ -118,12 +118,12 @@ class WCML_Terms{
|
|
118 |
//if ($tax != 'pa_frame') continue;
|
119 |
$terms = get_terms($tax);
|
120 |
if ($terms)foreach ($terms as $term) {
|
121 |
-
$term_order =
|
122 |
$trid = $this->sitepress->get_element_trid($term->term_taxonomy_id,'tax_'.$tax);
|
123 |
$translations = $this->sitepress->get_element_translations($trid,'tax_' . $tax);
|
124 |
if ($translations) foreach ($translations as $trans) {
|
125 |
if ($trans->language_code != $lang) {
|
126 |
-
|
127 |
}
|
128 |
}
|
129 |
}
|
@@ -132,12 +132,12 @@ class WCML_Terms{
|
|
132 |
//sync product categories ordering
|
133 |
$terms = get_terms('product_cat');
|
134 |
if ($terms) foreach($terms as $term) {
|
135 |
-
$term_order =
|
136 |
$trid = $this->sitepress->get_element_trid($term->term_taxonomy_id,'tax_product_cat');
|
137 |
$translations = $this->sitepress->get_element_translations($trid,'tax_product_cat');
|
138 |
if ($translations) foreach ($translations as $trans) {
|
139 |
if ($trans->language_code != $lang) {
|
140 |
-
|
141 |
}
|
142 |
}
|
143 |
}
|
@@ -147,7 +147,7 @@ class WCML_Terms{
|
|
147 |
$this->woocommerce_wpml->settings['is_term_order_synced'] = 'yes';
|
148 |
$this->woocommerce_wpml->update_settings();
|
149 |
|
150 |
-
}
|
151 |
|
152 |
function sync_term_order($meta_id, $object_id, $meta_key, $meta_value) {
|
153 |
|
@@ -192,9 +192,9 @@ class WCML_Terms{
|
|
192 |
foreach($translations as $translation){
|
193 |
if(!$translation->original){
|
194 |
if(isset($_POST['display_type'])){
|
195 |
-
|
196 |
}
|
197 |
-
|
198 |
}
|
199 |
}
|
200 |
}
|
@@ -1004,7 +1004,7 @@ class WCML_Terms{
|
|
1004 |
|
1005 |
foreach ( $translations as $translation ) {
|
1006 |
if ( $translation->element_id !== $object_id ) {
|
1007 |
-
update_term_meta( $translation->element_id, $meta_key, $meta_value
|
1008 |
}
|
1009 |
}
|
1010 |
|
118 |
//if ($tax != 'pa_frame') continue;
|
119 |
$terms = get_terms($tax);
|
120 |
if ($terms)foreach ($terms as $term) {
|
121 |
+
$term_order = get_term_meta( $term->term_id, $meta_key, true );
|
122 |
$trid = $this->sitepress->get_element_trid($term->term_taxonomy_id,'tax_'.$tax);
|
123 |
$translations = $this->sitepress->get_element_translations($trid,'tax_' . $tax);
|
124 |
if ($translations) foreach ($translations as $trans) {
|
125 |
if ($trans->language_code != $lang) {
|
126 |
+
update_term_meta( $trans->term_id, $meta_key, $term_order );
|
127 |
}
|
128 |
}
|
129 |
}
|
132 |
//sync product categories ordering
|
133 |
$terms = get_terms('product_cat');
|
134 |
if ($terms) foreach($terms as $term) {
|
135 |
+
$term_order = get_term_meta( $term->term_id, 'order', true );
|
136 |
$trid = $this->sitepress->get_element_trid($term->term_taxonomy_id,'tax_product_cat');
|
137 |
$translations = $this->sitepress->get_element_translations($trid,'tax_product_cat');
|
138 |
if ($translations) foreach ($translations as $trans) {
|
139 |
if ($trans->language_code != $lang) {
|
140 |
+
update_term_meta( $trans->term_id, 'order', $term_order );
|
141 |
}
|
142 |
}
|
143 |
}
|
147 |
$this->woocommerce_wpml->settings['is_term_order_synced'] = 'yes';
|
148 |
$this->woocommerce_wpml->update_settings();
|
149 |
|
150 |
+
}
|
151 |
|
152 |
function sync_term_order($meta_id, $object_id, $meta_key, $meta_value) {
|
153 |
|
192 |
foreach($translations as $translation){
|
193 |
if(!$translation->original){
|
194 |
if(isset($_POST['display_type'])){
|
195 |
+
update_term_meta( $translation->term_id, 'display_type', esc_attr( $_POST['display_type'] ) );
|
196 |
}
|
197 |
+
update_term_meta( $translation->term_id, 'thumbnail_id', apply_filters( 'translate_object_id', esc_attr( $_POST['product_cat_thumbnail_id'] ), 'attachment', true, $translation->language_code ) );
|
198 |
}
|
199 |
}
|
200 |
}
|
1004 |
|
1005 |
foreach ( $translations as $translation ) {
|
1006 |
if ( $translation->element_id !== $object_id ) {
|
1007 |
+
update_term_meta( $translation->element_id, $meta_key, $meta_value );
|
1008 |
}
|
1009 |
}
|
1010 |
|
inc/class-wcml-troubleshooting.php
CHANGED
@@ -170,12 +170,12 @@ class WCML_Troubleshooting{
|
|
170 |
add_option('wcml_sync_category_'.$category->term_taxonomy_id,true);
|
171 |
$trid = $this->sitepress->get_element_trid($category->term_taxonomy_id,'tax_product_cat');
|
172 |
$translations = $this->sitepress->get_element_translations($trid,'tax_product_cat');
|
173 |
-
$type =
|
174 |
-
$thumbnail_id =
|
175 |
foreach($translations as $translation){
|
176 |
if($translation->language_code != $category->language_code ){
|
177 |
-
|
178 |
-
|
179 |
}
|
180 |
}
|
181 |
}
|
170 |
add_option('wcml_sync_category_'.$category->term_taxonomy_id,true);
|
171 |
$trid = $this->sitepress->get_element_trid($category->term_taxonomy_id,'tax_product_cat');
|
172 |
$translations = $this->sitepress->get_element_translations($trid,'tax_product_cat');
|
173 |
+
$type = get_term_meta( $category->term_id, 'display_type',true );
|
174 |
+
$thumbnail_id = get_term_meta( $category->term_id, 'thumbnail_id',true );
|
175 |
foreach($translations as $translation){
|
176 |
if($translation->language_code != $category->language_code ){
|
177 |
+
update_term_meta( $translation->term_id, 'display_type', $type );
|
178 |
+
update_term_meta( $translation->term_id, 'thumbnail_id', apply_filters( 'translate_object_id', $thumbnail_id, 'attachment', true, $translation->language_code ) );
|
179 |
}
|
180 |
}
|
181 |
}
|
inc/currencies/class-wcml-multi-currency-orders.php
CHANGED
@@ -2,14 +2,20 @@
|
|
2 |
|
3 |
class WCML_Multi_Currency_Orders {
|
4 |
|
5 |
-
/**
|
6 |
-
* @var WCML_Multi_Currency
|
7 |
-
*/
|
8 |
private $multi_currency;
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
if ( is_admin() ) {
|
15 |
add_filter( 'init', array( $this, 'orders_init' ) );
|
@@ -19,10 +25,9 @@ class WCML_Multi_Currency_Orders {
|
|
19 |
}
|
20 |
|
21 |
public function orders_init() {
|
22 |
-
global $wp;
|
23 |
|
24 |
add_action( 'restrict_manage_posts', array( $this, 'show_orders_currencies_selector' ) );
|
25 |
-
$wp->add_query_var( '_order_currency' );
|
26 |
|
27 |
add_filter( 'posts_join', array( $this, 'filter_orders_by_currency_join' ) );
|
28 |
add_filter( 'posts_where', array( $this, 'filter_orders_by_currency_where' ) );
|
@@ -34,7 +39,10 @@ class WCML_Multi_Currency_Orders {
|
|
34 |
add_action( 'woocommerce_process_shop_order_meta', array( $this, 'set_order_currency_on_update' ), 10, 2 );
|
35 |
add_action( 'woocommerce_order_actions_start', array( $this, 'show_order_currency_selector' ) );
|
36 |
|
37 |
-
|
|
|
|
|
|
|
38 |
add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'add_woocommerce_hidden_order_itemmeta' ) );
|
39 |
|
40 |
add_action( 'wp_ajax_wcml_order_set_currency', array( $this, 'set_order_currency_on_ajax_update' ) );
|
@@ -153,6 +161,7 @@ class WCML_Multi_Currency_Orders {
|
|
153 |
isset( $_POST['action'] ) &&
|
154 |
in_array( $_POST['action'], array(
|
155 |
'woocommerce_add_order_item',
|
|
|
156 |
'woocommerce_calc_line_taxes',
|
157 |
'woocommerce_save_order_items'
|
158 |
)
|
@@ -254,17 +263,45 @@ class WCML_Multi_Currency_Orders {
|
|
254 |
|
255 |
}
|
256 |
|
257 |
-
public function set_totals_for_order_items( $items ) {
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
-
if ( isset( $_POST['action'] ) && in_array( $_POST['action'], array( 'woocommerce_add_order_item', 'woocommerce_save_order_items' ), true ) ) {
|
260 |
foreach ( $items as $item ) {
|
261 |
-
$this->set_converted_totals_for_item( $item );
|
262 |
}
|
263 |
}
|
264 |
|
265 |
return $items;
|
266 |
}
|
267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
public function add_woocommerce_hidden_order_itemmeta( $itemmeta ) {
|
269 |
|
270 |
$itemmeta[] = '_wcml_converted_subtotal';
|
@@ -274,107 +311,100 @@ class WCML_Multi_Currency_Orders {
|
|
274 |
return $itemmeta;
|
275 |
}
|
276 |
|
277 |
-
|
|
|
|
|
|
|
|
|
278 |
|
279 |
-
|
280 |
|
281 |
-
|
282 |
-
$order_currency = $this->get_order_currency_cookie();
|
283 |
|
284 |
-
if (
|
285 |
-
|
286 |
-
}
|
287 |
-
}
|
288 |
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
|
|
|
|
294 |
|
295 |
-
|
|
|
|
|
|
|
|
|
296 |
|
297 |
-
|
|
|
298 |
|
299 |
-
|
300 |
-
|
301 |
|
302 |
-
|
303 |
-
$converted_totals = array( 'subtotal' => 0, 'total' => 0 );
|
304 |
|
305 |
if ( ! $converted_price ) {
|
306 |
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
}
|
316 |
-
|
317 |
-
//re-calculate only new added items for performance reason
|
318 |
-
if ( $item->meta_exists( '_wcml_total_qty' ) && $item->get_quantity() !== (int)$item->get_meta( '_wcml_total_qty' ) ) {
|
319 |
-
|
320 |
-
$new_total = $item->get_quantity() * $this->multi_currency->prices->raw_price_filter( $item->get_product()->get_price(), $order_currency );
|
321 |
-
|
322 |
-
foreach( array_keys( $converted_totals ) as $key ) {
|
323 |
-
$converted_totals[ $key ] = $new_total;
|
324 |
-
$item->update_meta_data( '_wcml_converted_' . $key, $new_total );
|
325 |
-
}
|
326 |
-
}
|
327 |
-
|
328 |
-
$item->update_meta_data( '_wcml_total_qty', $item->get_quantity() );
|
329 |
-
}else{
|
330 |
-
|
331 |
-
$converted_price = wc_get_price_excluding_tax( $item->get_product(), array( 'price' => $converted_price, 'qty' => $item->get_quantity() ) );
|
332 |
-
foreach( array_keys( $converted_totals ) as $key ) {
|
333 |
-
$converted_totals[ $key ] = $converted_price;
|
334 |
}
|
335 |
-
}
|
336 |
|
337 |
-
|
338 |
-
|
339 |
}
|
340 |
|
341 |
-
$item
|
342 |
}
|
343 |
-
} else {
|
344 |
|
345 |
-
$
|
346 |
-
$
|
|
|
|
|
347 |
|
348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
|
350 |
-
|
351 |
-
if( isset( $item[ '_wcml_converted_subtotal' ] ) ){
|
352 |
-
$converted_subtotal_price = $item[ '_wcml_converted_subtotal' ] * $item['quantity'];
|
353 |
-
}else{
|
354 |
-
$converted_subtotal_price = $this->multi_currency->prices->raw_price_filter( $item['line_subtotal'], $order_currency );
|
355 |
-
$item[ '_wcml_converted_subtotal' ] = $converted_subtotal_price;
|
356 |
-
}
|
357 |
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
$
|
362 |
-
|
363 |
-
|
364 |
-
}else{
|
365 |
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
|
|
370 |
}
|
371 |
-
|
372 |
-
$item['line_subtotal'] = $converted_subtotal_price;
|
373 |
-
$item['line_total'] = $converted_total_price;
|
374 |
-
$item['mc_total_converted'] = true;
|
375 |
}
|
376 |
|
377 |
-
|
|
|
|
|
378 |
}
|
379 |
|
380 |
public function get_order_currency_cookie() {
|
2 |
|
3 |
class WCML_Multi_Currency_Orders {
|
4 |
|
5 |
+
/** @var WCML_Multi_Currency */
|
|
|
|
|
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() ) {
|
21 |
add_filter( 'init', array( $this, 'orders_init' ) );
|
25 |
}
|
26 |
|
27 |
public function orders_init() {
|
|
|
28 |
|
29 |
add_action( 'restrict_manage_posts', array( $this, 'show_orders_currencies_selector' ) );
|
30 |
+
$this->wp->add_query_var( '_order_currency' );
|
31 |
|
32 |
add_filter( 'posts_join', array( $this, 'filter_orders_by_currency_join' ) );
|
33 |
add_filter( 'posts_where', array( $this, 'filter_orders_by_currency_where' ) );
|
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 |
|
48 |
add_action( 'wp_ajax_wcml_order_set_currency', array( $this, 'set_order_currency_on_ajax_update' ) );
|
161 |
isset( $_POST['action'] ) &&
|
162 |
in_array( $_POST['action'], array(
|
163 |
'woocommerce_add_order_item',
|
164 |
+
'woocommerce_remove_order_item',
|
165 |
'woocommerce_calc_line_taxes',
|
166 |
'woocommerce_save_order_items'
|
167 |
)
|
263 |
|
264 |
}
|
265 |
|
266 |
+
public function set_totals_for_order_items( $items, $order ) {
|
267 |
+
|
268 |
+
if ( isset( $_POST['action'] ) && in_array( $_POST['action'], array(
|
269 |
+
'woocommerce_add_order_item',
|
270 |
+
'woocommerce_save_order_items'
|
271 |
+
), true ) ) {
|
272 |
|
|
|
273 |
foreach ( $items as $item ) {
|
274 |
+
$this->set_converted_totals_for_item( $item, $this->get_order_coupons_objects( $order ) );
|
275 |
}
|
276 |
}
|
277 |
|
278 |
return $items;
|
279 |
}
|
280 |
|
281 |
+
/**
|
282 |
+
* @param WC_Order $order
|
283 |
+
*
|
284 |
+
* @return array
|
285 |
+
*/
|
286 |
+
private function get_order_coupons_objects( $order ) {
|
287 |
+
|
288 |
+
remove_filter( 'woocommerce_order_get_items', array( $this, 'set_totals_for_order_items' ), 10, 2 );
|
289 |
+
|
290 |
+
$order_coupons = $order->get_items( 'coupon' );
|
291 |
+
$coupons_objects = array();
|
292 |
+
|
293 |
+
if ( $order_coupons ) {
|
294 |
+
foreach ( $order_coupons as $coupon ) {
|
295 |
+
$coupon_data = $coupon->get_data();
|
296 |
+
$coupons_objects[] = new WC_Coupon( $coupon_data['code'] );
|
297 |
+
}
|
298 |
+
}
|
299 |
+
|
300 |
+
add_filter( 'woocommerce_order_get_items', array( $this, 'set_totals_for_order_items' ), 10, 2 );
|
301 |
+
|
302 |
+
return $coupons_objects;
|
303 |
+
}
|
304 |
+
|
305 |
public function add_woocommerce_hidden_order_itemmeta( $itemmeta ) {
|
306 |
|
307 |
$itemmeta[] = '_wcml_converted_subtotal';
|
311 |
return $itemmeta;
|
312 |
}
|
313 |
|
314 |
+
/**
|
315 |
+
* @param WC_Order_Item_Product $item
|
316 |
+
* @param array $coupons
|
317 |
+
*/
|
318 |
+
private function set_converted_totals_for_item( $item, $coupons ) {
|
319 |
|
320 |
+
if ( 'line_item' === $item->get_type() ) {
|
321 |
|
322 |
+
$order_currency = get_post_meta( $_POST['order_id'], '_order_currency', true );
|
|
|
323 |
|
324 |
+
if ( ! $order_currency ) {
|
325 |
+
$order_currency = $this->get_order_currency_cookie();
|
|
|
|
|
326 |
|
327 |
+
if ( in_array( $_POST['action'], array(
|
328 |
+
'woocommerce_add_order_item',
|
329 |
+
'woocommerce_save_order_items'
|
330 |
+
), true ) ) {
|
331 |
+
update_post_meta( $_POST['order_id'], '_order_currency', $order_currency );
|
332 |
+
}
|
333 |
+
}
|
334 |
|
335 |
+
if ( ! isset( $this->multi_currency->prices ) ) {
|
336 |
+
$this->multi_currency->prices = new WCML_Multi_Currency_Prices( $this->multi_currency );
|
337 |
+
$this->multi_currency->prices->add_hooks();
|
338 |
+
$this->multi_currency->prices->prices_init();
|
339 |
+
}
|
340 |
|
341 |
+
$product_id = $item->get_variation_id() ? $item->get_variation_id() : $item->get_product_id();
|
342 |
+
$original_product_id = $this->woocommerce_wpml->products->get_original_product_id( $product_id );
|
343 |
|
344 |
+
$converted_price = get_post_meta( $original_product_id, '_price_' . $order_currency, true );
|
345 |
+
$converted_totals = array( 'subtotal' => 0, 'total' => 0 );
|
346 |
|
347 |
+
foreach ( array_keys( $converted_totals ) as $key ) {
|
|
|
348 |
|
349 |
if ( ! $converted_price ) {
|
350 |
|
351 |
+
$meta_key = '_wcml_converted_' . $key;
|
352 |
+
if (
|
353 |
+
! $item->meta_exists( $meta_key ) ||
|
354 |
+
( $item->meta_exists( '_wcml_total_qty' ) && $item->get_quantity() !== (int) $item->get_meta( '_wcml_total_qty' ) )
|
355 |
+
) {
|
356 |
+
$item_price = $this->multi_currency->prices->raw_price_filter( $item->get_product()->get_price(), $order_currency );
|
357 |
+
$converted_totals[ $key ] = $this->get_converted_item_meta( $key, $item_price, false, $item, $order_currency, $coupons );
|
358 |
+
$item->update_meta_data( $meta_key, $converted_totals[ $key ] );
|
359 |
+
} else {
|
360 |
+
$converted_totals[ $key ] = $item->get_meta( $meta_key );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
}
|
|
|
362 |
|
363 |
+
} else {
|
364 |
+
$converted_totals[ $key ] = $this->get_converted_item_meta( $key, $converted_price, true, $item, $order_currency, $coupons );
|
365 |
}
|
366 |
|
367 |
+
call_user_func_array( array( $item, 'set_' . $key ), array( $converted_totals[ $key ] ) );
|
368 |
}
|
|
|
369 |
|
370 |
+
$item->update_meta_data( '_wcml_total_qty', $item->get_quantity() );
|
371 |
+
$item->save();
|
372 |
+
}
|
373 |
+
}
|
374 |
|
375 |
+
/**
|
376 |
+
* @param string $meta
|
377 |
+
* @param string $item_price
|
378 |
+
* @param bool $is_custom_price
|
379 |
+
* @param WC_Order_Item_Product $item
|
380 |
+
* @param string $order_currency
|
381 |
+
* @param array $coupons
|
382 |
+
*
|
383 |
+
* @return int
|
384 |
+
*/
|
385 |
+
private function get_converted_item_meta( $meta, $item_price, $is_custom_price, $item, $order_currency, $coupons ) {
|
386 |
|
387 |
+
if ( 'total' === $meta && $coupons ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
|
389 |
+
$discount_amount = 0;
|
390 |
+
foreach ( $coupons as $coupon ) {
|
391 |
+
if ( $coupon->is_type( 'percent' ) ) {
|
392 |
+
$discount_amount += $coupon->get_discount_amount( $item_price );
|
393 |
+
} elseif ( $coupon->is_type( 'fixed_product' ) ) {
|
394 |
+
$coupon_discount = $coupon->get_discount_amount( $item_price, array(), true );
|
|
|
395 |
|
396 |
+
if ( $is_custom_price && $coupon_discount != $item_price ) {
|
397 |
+
$coupon_discount = $this->multi_currency->prices->raw_price_filter( $coupon_discount, $order_currency );
|
398 |
+
}
|
399 |
+
$discount_amount += $coupon_discount;
|
400 |
+
}
|
401 |
}
|
402 |
+
$item_price = $item_price - $discount_amount;
|
|
|
|
|
|
|
403 |
}
|
404 |
|
405 |
+
$converted_meta = $item->get_quantity() * wc_get_price_excluding_tax( $item->get_product(), array( 'price' => $item_price ) );
|
406 |
+
|
407 |
+
return $converted_meta;
|
408 |
}
|
409 |
|
410 |
public function get_order_currency_cookie() {
|
inc/currencies/class-wcml-multi-currency-prices.php
CHANGED
@@ -588,6 +588,7 @@ class WCML_Multi_Currency_Prices {
|
|
588 |
|
589 |
$actions = array(
|
590 |
'woocommerce_add_order_item',
|
|
|
591 |
'woocommerce_save_order_items',
|
592 |
'woocommerce_calc_line_taxes'
|
593 |
);
|
588 |
|
589 |
$actions = array(
|
590 |
'woocommerce_add_order_item',
|
591 |
+
'woocommerce_remove_order_item',
|
592 |
'woocommerce_save_order_items',
|
593 |
'woocommerce_calc_line_taxes'
|
594 |
);
|
inc/currencies/class-wcml-multi-currency.php
CHANGED
@@ -95,7 +95,7 @@ class WCML_Multi_Currency{
|
|
95 |
* WCML_Multi_Currency constructor.
|
96 |
*/
|
97 |
public function __construct(){
|
98 |
-
global $woocommerce_wpml, $sitepress, $wpdb, $wp_locale;
|
99 |
|
100 |
$this->woocommerce_wpml =& $woocommerce_wpml;
|
101 |
|
@@ -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 );
|
120 |
$this->admin_currency_selector = new WCML_Admin_Currency_Selector(
|
121 |
$woocommerce_wpml,
|
122 |
new WCML_Admin_Cookie( '_wcml_dashboard_currency' )
|
95 |
* WCML_Multi_Currency constructor.
|
96 |
*/
|
97 |
public function __construct(){
|
98 |
+
global $woocommerce_wpml, $sitepress, $wpdb, $wp_locale, $wp;
|
99 |
|
100 |
$this->woocommerce_wpml =& $woocommerce_wpml;
|
101 |
|
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' )
|
inc/translation-editor/class-wcml-synchronize-product-data.php
CHANGED
@@ -53,8 +53,8 @@ class WCML_Synchronize_Product_Data{
|
|
53 |
|
54 |
add_action( 'woocommerce_product_set_visibility', array( $this, 'sync_product_translations_visibility' ) );
|
55 |
|
56 |
-
add_action( 'woocommerce_product_set_stock', array( $this, '
|
57 |
-
add_action( 'woocommerce_variation_set_stock', array( $this, '
|
58 |
add_action( 'woocommerce_recorded_sales', array( $this, 'sync_product_total_sales' ) );
|
59 |
|
60 |
add_action( 'woocommerce_product_set_stock_status', array($this, 'sync_stock_status_for_translations' ), 100, 2);
|
@@ -315,12 +315,11 @@ class WCML_Synchronize_Product_Data{
|
|
315 |
* @param $translated_product
|
316 |
*/
|
317 |
public function sync_product_stock( $product, $translated_product = false ) {
|
318 |
-
|
319 |
$stock = $product->get_stock_quantity();
|
320 |
$product_id = $product->get_id();
|
321 |
|
322 |
-
remove_action( 'woocommerce_product_set_stock', array( $this, '
|
323 |
-
remove_action( 'woocommerce_variation_set_stock', array( $this, '
|
324 |
|
325 |
if( $translated_product ){
|
326 |
wc_update_product_stock( $translated_product, $stock );
|
@@ -334,8 +333,30 @@ class WCML_Synchronize_Product_Data{
|
|
334 |
}
|
335 |
}
|
336 |
|
337 |
-
add_action( 'woocommerce_product_set_stock', array( $this, '
|
338 |
-
add_action( 'woocommerce_variation_set_stock', array( $this, '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
}
|
340 |
|
341 |
/**
|
53 |
|
54 |
add_action( 'woocommerce_product_set_visibility', array( $this, 'sync_product_translations_visibility' ) );
|
55 |
|
56 |
+
add_action( 'woocommerce_product_set_stock', array( $this, 'sync_product_stock_hook' ) );
|
57 |
+
add_action( 'woocommerce_variation_set_stock', array( $this, 'sync_product_stock_hook' ) );
|
58 |
add_action( 'woocommerce_recorded_sales', array( $this, 'sync_product_total_sales' ) );
|
59 |
|
60 |
add_action( 'woocommerce_product_set_stock_status', array($this, 'sync_stock_status_for_translations' ), 100, 2);
|
315 |
* @param $translated_product
|
316 |
*/
|
317 |
public function sync_product_stock( $product, $translated_product = false ) {
|
|
|
318 |
$stock = $product->get_stock_quantity();
|
319 |
$product_id = $product->get_id();
|
320 |
|
321 |
+
remove_action( 'woocommerce_product_set_stock', array( $this, 'sync_product_stock_hook' ) );
|
322 |
+
remove_action( 'woocommerce_variation_set_stock', array( $this, 'sync_product_stock_hook' ) );
|
323 |
|
324 |
if( $translated_product ){
|
325 |
wc_update_product_stock( $translated_product, $stock );
|
333 |
}
|
334 |
}
|
335 |
|
336 |
+
add_action( 'woocommerce_product_set_stock', array( $this, 'sync_product_stock_hook' ) );
|
337 |
+
add_action( 'woocommerce_variation_set_stock', array( $this, 'sync_product_stock_hook' ) );
|
338 |
+
}
|
339 |
+
|
340 |
+
/**
|
341 |
+
* @param $product
|
342 |
+
*/
|
343 |
+
public function sync_product_stock_hook( $product ){
|
344 |
+
$is_posts_hook_removed = remove_action( 'save_post', array(
|
345 |
+
$this->post_translations,
|
346 |
+
'save_post_actions',
|
347 |
+
100
|
348 |
+
) );
|
349 |
+
$is_synchronize_products_hook_removed = remove_action( 'save_post', array( $this, 'synchronize_products' ), PHP_INT_MAX );
|
350 |
+
|
351 |
+
$this->sync_product_stock( $product );
|
352 |
+
|
353 |
+
if( $is_posts_hook_removed ){
|
354 |
+
add_action( 'save_post', array( $this->post_translations, 'save_post_actions' ), 100, 2 );
|
355 |
+
}
|
356 |
+
|
357 |
+
if( $is_synchronize_products_hook_removed ){
|
358 |
+
add_action( 'save_post', array( $this, 'synchronize_products' ), PHP_INT_MAX, 2 );
|
359 |
+
}
|
360 |
}
|
361 |
|
362 |
/**
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: AmirHelzer, sergey.r, mihaimihai, EduardMaghakyan, andrewp-2
|
|
3 |
Donate link: http://wpml.org/documentation/related-projects/woocommerce-multilingual/
|
4 |
Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
|
5 |
License: GPLv2
|
6 |
-
Requires at least:
|
7 |
Tested up to: 5.1.1
|
8 |
-
Stable tag: 4.
|
9 |
|
10 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
11 |
|
@@ -64,7 +64,7 @@ Without having all these running, WooCommerce Multilingual will not be able to r
|
|
64 |
|
65 |
= Minimum Requirements =
|
66 |
|
67 |
-
* WordPress
|
68 |
* PHP version 5.6 or later
|
69 |
* MySQL version 5.6 or later
|
70 |
|
@@ -140,6 +140,18 @@ WooCommerce Multilingual is compatible with all major WooCommerce extensions. We
|
|
140 |
|
141 |
== Changelog ==
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
= 4.5.0 =
|
144 |
* Add "get_post_metadata" hook to filter Woocommerce product data
|
145 |
* Added function in troubleshooting page to fix broken variations
|
3 |
Donate link: http://wpml.org/documentation/related-projects/woocommerce-multilingual/
|
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.0
|
9 |
|
10 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
11 |
|
64 |
|
65 |
= Minimum Requirements =
|
66 |
|
67 |
+
* WordPress 4.7 or later
|
68 |
* PHP version 5.6 or later
|
69 |
* MySQL version 5.6 or later
|
70 |
|
140 |
|
141 |
== Changelog ==
|
142 |
|
143 |
+
= 4.6.0 =
|
144 |
+
* Fix wrong currency code after removing item from manually created order
|
145 |
+
* Replace *_woocommerce_term_meta functions on *_term_meta
|
146 |
+
* Fix gallery images not showing up on translated product page
|
147 |
+
* Fix double calculating order item price while manually adding it from admin to order with WooCommerce 3.6.0
|
148 |
+
* Fix performance issues on checkout with manage stock products
|
149 |
+
* Fix performance issue on shop page with WooCommerce 3.6
|
150 |
+
* Fix loading scripts on admin pages
|
151 |
+
* Fix coupon discount when editing order from admin
|
152 |
+
* Fix wrong product price after adding another product to existing order from admin
|
153 |
+
* Fix my-account page endpoints in secondary language with pages set to "Display as translated"
|
154 |
+
|
155 |
= 4.5.0 =
|
156 |
* Add "get_post_metadata" hook to filter Woocommerce product data
|
157 |
* Added function in troubleshooting page to fix broken variations
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderIniteff130337e9970a14836f2e0d29e7e53::getLoader();
|
vendor/autoload_52.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInitf9df06b740c92d3a63a4d7b27e1b059b::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitdd99bdc714d3a0da336f7270f9054514
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
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\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInitdd99bdc714d3a0da336f7270f9054514
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderIniteff130337e9970a14836f2e0d29e7e53
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderIniteff130337e9970a14836f2e0d29e7e53', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderIniteff130337e9970a14836f2e0d29e7e53', '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\ComposerStaticIniteff130337e9970a14836f2e0d29e7e53::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\ComposerStaticIniteff130337e9970a14836f2e0d29e7e53::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequireeff130337e9970a14836f2e0d29e7e53($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequireeff130337e9970a14836f2e0d29e7e53($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
|
6 |
private static $loader;
|
7 |
|
8 |
public static function loadClassLoader($class) {
|
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit077a9de49a58a2d7a901028b88774abf {
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$vendorDir = dirname(dirname(__FILE__));
|
27 |
$baseDir = dirname($vendorDir);
|
2 |
|
3 |
// autoload_real_52.php generated by xrstf/composer-php52
|
4 |
|
5 |
+
class ComposerAutoloaderInitf9df06b740c92d3a63a4d7b27e1b059b {
|
6 |
private static $loader;
|
7 |
|
8 |
public static function loadClassLoader($class) {
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitf9df06b740c92d3a63a4d7b27e1b059b', 'loadClassLoader'), true /*, true */);
|
23 |
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitf9df06b740c92d3a63a4d7b27e1b059b', '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
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'b45b351e6b6f7487d819961fef2fda77' => __DIR__ . '/..' . '/jakeasmith/http_build_url/src/http_build_url.php',
|
@@ -242,10 +242,10 @@ class ComposerStaticInitdd99bdc714d3a0da336f7270f9054514
|
|
242 |
public static function getInitializer(ClassLoader $loader)
|
243 |
{
|
244 |
return \Closure::bind(function () use ($loader) {
|
245 |
-
$loader->prefixLengthsPsr4 =
|
246 |
-
$loader->prefixDirsPsr4 =
|
247 |
-
$loader->prefixesPsr0 =
|
248 |
-
$loader->classMap =
|
249 |
|
250 |
}, null, ClassLoader::class);
|
251 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticIniteff130337e9970a14836f2e0d29e7e53
|
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 = ComposerStaticIniteff130337e9970a14836f2e0d29e7e53::$prefixLengthsPsr4;
|
246 |
+
$loader->prefixDirsPsr4 = ComposerStaticIniteff130337e9970a14836f2e0d29e7e53::$prefixDirsPsr4;
|
247 |
+
$loader->prefixesPsr0 = ComposerStaticIniteff130337e9970a14836f2e0d29e7e53::$prefixesPsr0;
|
248 |
+
$loader->classMap = ComposerStaticIniteff130337e9970a14836f2e0d29e7e53::$classMap;
|
249 |
|
250 |
}, null, ClassLoader::class);
|
251 |
}
|
wpml-woocommerce.php
CHANGED
@@ -6,18 +6,18 @@
|
|
6 |
Author: OnTheGoSystems
|
7 |
Author URI: http://www.onthegosystems.com/
|
8 |
Text Domain: woocommerce-multilingual
|
9 |
-
Requires at least:
|
10 |
Tested up to: 5.1.1
|
11 |
-
Version: 4.
|
12 |
WC requires at least: 3.3.0
|
13 |
-
WC tested up to: 3.
|
14 |
*/
|
15 |
|
16 |
if ( defined( 'WCML_VERSION' ) ) {
|
17 |
return;
|
18 |
}
|
19 |
|
20 |
-
define( 'WCML_VERSION', '4.
|
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' );
|
6 |
Author: OnTheGoSystems
|
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.0
|
12 |
WC requires at least: 3.3.0
|
13 |
+
WC tested up to: 3.6.0
|
14 |
*/
|
15 |
|
16 |
if ( defined( 'WCML_VERSION' ) ) {
|
17 |
return;
|
18 |
}
|
19 |
|
20 |
+
define( 'WCML_VERSION', '4.6.0' );
|
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' );
|