Skip Navigation

Open

Reported for: WooCommerce Multilingual & Multicurrency 5.2.1

Topic Tags: Bug, WCML

Overview of the issue

When WooCommerce Multilingual 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;
}

2 Responses to “WooCommerce Multilingual Significantly Slows Down REST-API Response During Bulk Product Updates”

  1. Hi,
    Can you please do something about this problem. On some sites there are huge problems of slowness that cause lost sales. Problems with API access with WPML. I’m losing my customers and I don’t know what to do.
    Thank you and best regards

    • Hello Odile,

      Our development team is working to resolve performance issues in this development cycle.

      If you have not yet opened a ticket on our forum, I suggest opening a new ticket so that our developers can analyze your specific case.

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>