- Status
- Open
- Reported for
- WPML Multilingual & Multicurrency for WooCommerce 5.2.1
- Topic tags
- Bug, WCML
Overview of the issue
When WPML Multilingual & Multicurrency for WooCommerce is activated, the response time for bulk product updates via the REST-API is significantly longer.
Workaround
Before using these workaround do remember to consider possible caveats.
It is possible that not all of your data is synchronized between translations and potentially show stale information.
To try to remedy the product updating issues you can try:
add_filter('rest_pre_dispatch', function ($result, $server, $request) {
global $woocommerce_wpml;
$params = serialize($request->get_params());
if (str_contains($params, 'stock_quantity')){
remove_filter( 'get_post_metadata', [ $woocommerce_wpml->products, 'filter_product_data' ] );
}
return $result;
}, 10, 3);
If you still have slowness issues and your product is assigned to multiple categories and the product has many translations, you can try and bypass the term recount
add_filter( 'woocommerce_product_recount_terms', 'bypass_term_recount_on_rest' );
function bypass_term_recount_on_rest( $value ){
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
$value = false;
}
return $value;
}