Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client reported a fatal error caused by the WooCommerce Multilingual & Multicurrency plugin when trying to add a product to the cart on their WooCommerce site. The error message indicated an issue with calling a function on a null value within the WooCommerce Subscriptions plugin.

Solution:
1. We attempted to replicate the issue but were unable to do so. We requested a screen recording to better understand the problem and asked for FTP access for further troubleshooting.
2. We identified that the issue might be related to a known problem with WooCommerce payment details being displayed twice. We provided a workaround that can be found in our errata page: https://wpml.org/errata/woocommerce-payment-details-are-displayed-twice-on-the-order-confirmation-page-e-mail/.
3. We informed the client that the patch they applied will be included in the next official update of the WooCommerce Multilingual & Multicurrency plugin, ensuring that the patch will not be overwritten by future updates.

If this solution doesn't look relevant to your issue, please don't hesitate to open a new support ticket with us here: WPML support forum.

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.

Tagged: 

This topic contains 23 replies, has 2 voices.

Last updated by Kor 1 year, 3 months ago.

Assisted by: Kor.

Author Posts
December 4, 2023 at 10:24 pm #14991797

manfredR-5

Hi Team,

Would like to submit a fatal error, caused by the WooCommerce Multilingual & Multicurrency plugin. This issue is critical as the live site is strongly impacted.

The link below causes a fatal error “sometimes/after a couple of tries”
hidden link

Error message
Fatal error: Uncaught Error: Call to a member function payment_gateways() on null in /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:653 Stack trace: #0 /home/customer/www/staging11.kieferfreund.com/public_html/wp-includes/class-wp-hook.php(324): WC_Subscriptions_Cart::check_cod_gateway_for_free_trials(Array) #1 /home/customer/www/staging11.kieferfreund.com/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #2 /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(163): apply_filters('woocommerce_ava...', Array) #3 /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce-multilingual/classes/multi-currency/payment-gateways/class-wcml-currencies-payment-gateways.php(216): WC_Payment_Gateways->get_available_payment_gateways() #4 /home/customer/www/staging11.kiefe in /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php on line 653

As you can see above/below the WooCommerce Multilingual & Multicurrency plugin is being used

/home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce-multilingual/classes/multi-currency/payment-gateways/class-wcml-currencies-payment-gateways.php(216)
hidden link

You can reproduce the error on a staging copy:

Wordpress: 6.4.1
Divi: 4.23.1
Woocommerce: 8.3.1
Woo Subscriptions: 5.7.0

Please feel free activating/deactivating the WooCommerce Multilingual & Multicurrency plugin

-----------------------------------------------------------------------------------------------------------
hidden link is currently running in recovery mode and wordpress is setting it on hold if the error occurs.

Woo Subscriptions
Deactivate | Resume
Sell products and services with recurring payments in your WooCommerce Store.
Version 5.7.0 | By WooCommerce | View details
This plugin failed to load properly and is paused during recovery mode.
An error of type E_ERROR was caused in line 653 of the file /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php. Error message: Uncaught Error: Call to a member function payment_gateways() on null in /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:653 Stack trace: #0 /home/customer/www/staging11.kieferfreund.com/public_html/wp-includes/class-wp-hook.php(324): WC_Subscriptions_Cart::check_cod_gateway_for_free_trials(Array) #1 /home/customer/www/staging11.kieferfreund.com/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #2 /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(163): apply_filters('woocommerce_ava...', Array) #3 /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce-multilingual/classes/multi-currency/payment-gateways/class-wcml-currencies-payment-gateways.php(216): WC_Payment_Gateways->get_available_payment_gateways() #4 /home/customer/www/staging11.kiefe

Please resume it and you can reproduce the error.

After a couple of tries
---------------------------
hidden link

and press the “add to cart” button

----------------------------

The error occurs again.

Thank you for your help,
Manfred

December 5, 2023 at 3:07 pm #14999915

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for contacting WPML support.

I've checked your Website and I can't seem to replicate the issue following the instructions provided. I've clicked on the "Add to cart" button here hidden link and I'm able to add the product into the cart without issues. Could you kindly record a short screen recording using this free tool hidden link to show me what you're getting over there?

Also, could you please share FTP access here so that I could use it for troubleshooting purposes?

Screenshot_388.png
December 5, 2023 at 4:50 pm #15001171

manfredR-5

Thank you, Kor!

You need to try this sequence a couple of times. Here a loom video where the issue occurred after the 2nd time:
hidden link

after the issue occurred you will see that the woo subscription plugin is being disabled (due to the recovery mode I'm running)

Woo Subscriptions
Deactivate | Resume
Sell products and services with recurring payments in your WooCommerce Store.

Version 5.7.0 | By WooCommerce | Visit plugin site
This plugin failed to load properly and is paused during recovery mode.

An error of type E_ERROR was caused in line 653 of the file /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php. Error message: Uncaught Error: Call to a member function payment_gateways() on null in /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:653 Stack trace: #0 /home/customer/www/staging11.kieferfreund.com/public_html/wp-includes/class-wp-hook.php(324): WC_Subscriptions_Cart::check_cod_gateway_for_free_trials(Array) #1 /home/customer/www/staging11.kieferfreund.com/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #2 /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(163): apply_filters('woocommerce_ava...', Array) #3 /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce-multilingual/classes/multi-currency/payment-gateways/class-wcml-currencies-payment-gateways.php(216): WC_Payment_Gateways->get_available_payment_gateways() #4 /home/customer/www/staging11.kiefe

December 6, 2023 at 3:09 pm #15009091

manfredR-5

Hi Team, I kindly ask you whether you could reproduce the fatal error. Do you need any additional help from my side please?

Thank you,
Manfred

December 6, 2023 at 4:01 pm #15009751

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thank you for getting back to me.

I have successfully reproduced the problem on your staging site. It appears there may be a conflict between Woocommerce Subscription and WooCommerce Multilingual & Multicurrency.

May I have permission to deactivate plugins on your staging site? Additionally, could you kindly attempt to recreate the issue on our sandbox site at this address: hidden link

If you can replicate the issue on our sandbox site, I can promptly escalate it to our 2nd Tier Support for a more thorough investigation. If not, we will need to carry out a few more troubleshooting steps on your website to further examine the matter.

December 6, 2023 at 5:10 pm #15010795

manfredR-5

Hi Kor,

Yes, you have the permission to deactivate plugins on my staging.

What I learned from your sandbox, there is a different version of WooCommerce Multilingual & Multicurrency plugin available (5.3.1). On my staging there is 5.3.0 available. I don't have the option to upgrade to 5.3.1.

Therefore it doesn't make sense to reproduce the error on your sandbox... Maybe an upgrade on my staging to 5.3.1 (if available) could resolve the issue.

How should we proceed please?

Thank you, Manfred

December 6, 2023 at 7:04 pm #15011691

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your reply.

I'm still getting the error after updating to 5.3.1 . Would you like to replicate the issue on our sandbox site?

If not, we kindly request a site snapshot. Alternatively, with your permission, we can create a snapshot on our own.

For this purpose, we typically recommend using the free plugin "Duplicator." If you are already familiar with how Duplicator works ( https://wordpress.org/plugins/duplicator/),
please skip the following steps and simply send me the archive file you downloaded.

To assist you further, please follow these instructions:
Watch the Duplicator instructions video: hidden link

Refer to the instructions provided by WPML on how to provide supporters a copy of your site: https://wpml.org/faq/provide-supporters-copy-site/

If the archive file exceeds 400MB in size, please utilize Duplicator's file filters to exclude the cache, wp-uploads directory, media, and archive files.

Once you have the archive file, please share the link with us. You can use services such as Google Drive, Dropbox, or similar platforms as the snapshot file will likely be large.

Please note that your next reply will be private, visible only to you and me. You can paste the link to the file there. Rest assured that once the issue is resolved, I will delete the local site.

December 7, 2023 at 7:15 pm #15020693

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thank you for responding. I've successfully imported the website into my local development environment, and I'll be conducting a more in-depth investigation. I'll get back to you with my findings soon.

December 7, 2023 at 11:04 pm #15022043

manfredR-5

Hi Kor, thank you for your status update and help!

Kind Regards,
Manfred

December 11, 2023 at 6:16 pm #15040049

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your patience.

I will escalate this further to our 2nd Tier Support for further assistance. I will come back to you once I've feedback.

December 20, 2023 at 12:35 pm #15102107

manfredR-5

Hi Kor, I didn't hear back from you for 8 days. Please would you give me a status update.

Thank you,
Manfred

December 20, 2023 at 7:09 pm #15105647

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

I appreciate your understanding.

Apologies for the wait. Our secondary support team has reviewed the situation and is requesting that we attempt to reproduce the issue on our test environment. I am currently addressing this matter on our sandbox site, which can be accessed here: hidden link. If additional information is needed, I will reach out accordingly.

December 22, 2023 at 4:40 pm #15119973

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thank you for your response.

I'm having trouble reproducing the problem on my end when visiting hidden link . Here is an example of the translated subscription hidden link

After examining your website, I observed that I'm unable to activate any payment methods at hidden link. This issue may be linked to the problem, and when I attempt to enable a payment method, I encounter console errors, as depicted in the attached screenshot. It appears to be related to server permissions. Could you please reach out to your hosting provider to investigate this issue?

Screenshot_460.png
December 25, 2023 at 10:18 am #15125961

manfredR-5

Hi Kor,

thank you for your reply. I'm a little bit confused as you already were able to reproduce the issue on staging 11: we have a conflict between Woo Subscriptions and WooCommerce Multilingual & Multicurrency plugin.

I'm able to activate payment methods and activated the PayPal Standard payment method on staging11 just now. You should be able to reproduce the fatal error.

Please use this link:
hidden link
and click the "Add to cart" button and you get it:

Fatal error: Uncaught Error: Call to a member function payment_gateways() on null in /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php:653 Stack trace: #0 /home/customer/www/staging11.kieferfreund.com/public_html/wp-includes/class-wp-hook.php(324): WC_Subscriptions_Cart::check_cod_gateway_for_free_trials(Array) #1 /home/customer/www/staging11.kieferfreund.com/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #2 /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(163): apply_filters('woocommerce_ava...', Array) #3 /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce-multilingual/classes/multi-currency/payment-gateways/class-wcml-currencies-payment-gateways.php(216): WC_Payment_Gateways->get_available_payment_gateways() #4 /home/customer/www/staging11.kiefe in /home/customer/www/staging11.kieferfreund.com/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscriptions-cart.php on line 653

Please let me know whether you can reproduce the error on your side.

Thank you,
Manfred

December 25, 2023 at 10:31 am #15125965

manfredR-5

Hi Kor,

I also saw that there is no payment gateway installed for recurring payments on your sandbox.

Here is the warning:

Recurring Payments
No payment gateways capable of processing automatic subscription payments are enabled. If you would like to process automatic payments, we recommend the free Stripe extension.

Payment gateways which don’t support automatic recurring payments can be used to process manual subscription renewal payments.

Find new gateways that support automatic subscription payments in the official WooCommerce Marketplace.

Maybe this is helpful for you.

Thank you,
Manfred