Skip to content Skip to sidebar

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
- 8:00 – 15:00 8:00 – 15:00 8:00 – 15:00 8:00 – 15:00 8:00 – 15:00 -
- 16:00 – 17:00 16:00 – 17:00 16:00 – 17:00 16:00 – 17:00 16:00 – 17:00 -

Supporter timezone: Europe/Rome (GMT+02:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by Alejandro 2 years, 2 months ago.

Assisted by: Alejandro.

Author Posts
April 28, 2022 at 1:11 pm #11115011

andorG

Hello! Please see title.

Please take a look at the following excerpt of a stack trace:

class-wc-shipping.php:221, WC_Shipping->get_shipping_methods()
class-wcml-wc-shipping.php:46, WCML_WC_Shipping->shipping_methods_filters()
class-wcml-wc-shipping.php:41, WCML_WC_Shipping->add_hooks()
class-woocommerce-wpml.php:226, woocommerce_wpml->init()

Please take the debug information and sandbox machine from my other open ticket: https://wpml.org/forums/topic/wcml-is-doing-hundreds-of-updates-when-visiting-an-order-through-admin/

Issue:
Calling get_shipping_methods should not be called on every page load, but only when necessary. This call can be potentially quite heavy, as it checks with all shipping providers, if they are available, etc. This can be _super_ heavy, as it might even call external APIs!

WooCommerce knows this, and does a call to `get_shipping_methods()` only when absolutely necessary. WCML does this on _every_ init()!

April 30, 2022 at 11:25 am #11126353

Alejandro
WPML Supporter since 02/2018

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello there!

This sounds indeed as something that should not be happening.

If you can give me the steps to recreate the problem in the sandbox site you used before, i'd be able to escalate the case ( hidden link ).

I'm asking this because went to the admin page of the sandbox to run a quick test. I used the query monitor plugin > Request > Hooks in use in different places of the admin screen but i didn't see any shipping related WC call.

However, you quote a stack trace so you probably used a different way to debug this, right? can you test it in the sandbox and check if the problem happens there as well + let me know the steps you took, please?

Thanks in advance.

May 2, 2022 at 9:56 am #11131955

andorG

Hello! Please note that after the initial init hook, there are no hooks involved. It's just "normal" methods calling methods. Please also note that I am not talking about the admin / backend interface, but the front end! just going to /shop does the trick, sadly.

The stack trace is quite straightforward for this, but I assume you would need a developer environment and setting up XDEBUG.

As for if the `init`: It's called on plugin load (wp `init` hook), and for this you can find this in the screenshot for example.

Screenshot from 2022-05-02 11-52-29.png
May 2, 2022 at 2:53 pm #11134219

Alejandro
WPML Supporter since 02/2018

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Thank you very much. i sent all this information to the ticket we had created for this on our end.

We are currently working to improve WooCommerce Multilingual so you might get some performance bugfixes and improvements in the next version.

October 2, 2023 at 12:57 pm #14498177

Alejandro
WPML Supporter since 02/2018

Languages: English (English ) Spanish (Español ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello!

I know it's been a while since my last reply. i just wanted to let you know that major performance fixes, including the one for this issue will be included into WooCommerce Multilingual V5.3.0.

This one was a tough one because when we had a stable version, WooCommerce changed a lot of the things we relied on and we had to start over and work in a more secure way 🙁

Regards.