Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 14:00 9:00 – 14:00 9:00 – 14:00 9:00 – 14:00 9:00 – 14:00 -
- 15:00 – 18:00 15:00 – 18:00 15:00 – 18:00 15:00 – 18:00 15:00 – 18:00 -

Supporter timezone: Asia/Dhaka (GMT+06:00)

This topic contains 34 replies, has 2 voices.

Last updated by Prosenjit Barman 1 year, 2 months ago.

Assisted by: Prosenjit Barman.

Author Posts
March 8, 2024 at 6:58 am #15387350

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Thank you so much for sharing the steps and the report.

I have forwarded the information to the development team for further investigation. As soon as I have more information, I will immediately inform you.

I truly appreciate your kind cooperation in this matter.

Best regards,
Prosenjit

March 12, 2024 at 6:14 am #15397723

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hi There,
I hope you're doing well.

The development team has provided an update after a detailed analysis of the profiler. They pinpointed the cause of the delay experienced on your side. The primary issue stems from a specific function that was invoked repeatedly, and with each call, hooks from WCML were also triggered, which contributed to the slowdown.

However, our dev team has found a potential workaround for this issue. After implementing the solution, we noticed that the time required to complete the request was reduced by approximately 40%. Please check the Blackfire comparison from this link: hidden link

Here's what you have to do:

- Please open the 'functions.php' file of your theme
- Add the following code to the file:

add_filter('rest_pre_dispatch', function ($result, $server, $request) {
	global $woocommerce_wpml;
	// $request contains the request parameters
	$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);

- Once added, try to batch update the stock.

To see the difference in performance, you could first update the stock in batches using the code workaround, and then perform the update again without using the workaround. Please pay attention and test it thoroughly and hopefully, you'll also notice the improvement.

Please let me know the update. We will be happy to help if you need further assistance in this matter.

Best regards,
Prosenjit

March 13, 2024 at 7:09 am #15402166

aarniH

With plugin enabled and with the fix, it's about 31% faster than without the fix. However disabling the plugin makes it over 90% faster than even with the fix enabled.

I made 3 more profiler dumps, could you please re-enable the hidden field.

March 14, 2024 at 3:26 am #15406249

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hi,

Thank you for the update. The WooCommerce Multilingual contains multiple synchronization mechanisms, which is why, achieving the 90% improved result could be difficult, but not impossible. Our development team is actively working on optimizing the performance of the WCML plugin and we are expecting that the performance will be improved a lot in the upcoming versions.

However, I have enabled the private box for you so that you can securely share the profiler. I'm hopeful that this will provide us with insights that could help in improving the performance.

Looking forward to your responses and I appreciate your continuous cooperation in this matter.

Best regards,
Prosenjit

March 14, 2024 at 8:37 am #15408152

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

I appreciate your understanding. It's important to note that certain filters and actions within WCML may require some time to execute, as they are crucial for its proper functionality.

However, Thank you so much for sharing the profiler. I've forwarded it to our team for a more detailed analysis. As soon as I have more information on this, I will inform you.

Thanks a lot for your cooperation and patience while we are working on this issue.

Best regards,
Prosenjit