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
- 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 -
- 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 -

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

This topic contains 7 replies, has 2 voices.

Last updated by Bigul 1 year, 9 months ago.

Assisted by: Bigul.

Author Posts
January 10, 2024 at 3:21 pm #15169704

rubenP-11

After activating and configuring multicurrency, my cart does not work while I am logged in.

I add items to the cart and when I go to view it it appears empty, the error seems to be related to incorrect calls to the get_cart function before the wp_loaded action has taken place.

All plugins are updated

LOG SERVER:

AH01071: Got error 'PHP message: get_cart was called incorrectly. Adquirir carrito no deber\xc3\xada ser llamado antes de la acci\xc3\xb3n wp_loaded Backtrace: require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_wpml->init, woocommerce_wpml->get_multi_currency, WPML\\Container\\make, call_user_func_array, WPML\\FP\\{closure}, call_user_func_array, WPML\\Container\\{closure}, WPML\\Container\\Container::make, WPML\\Auryn\\Injector->make, WPML\\Auryn\\Injector->provisionInstance, WPML\\Auryn\\Injector->instantiateWithoutCtorParams, WCML_Multi_Currency->__construct, WCML_Multi_Currency->are_filters_need_loading, WCML_Multi_Currency->get_client_currency, WCML\\MultiCurrency\\Resolver\\ComposedResolver->getClientCurrency, call_user_func, WPML\\FP\\{closure}, call_user_func_array, WPML\\FP\\Logic::WPML\\FP\\{closure}, WCML\\MultiCurrency\\Resolver\\ResolverForModeLocation->getClientCurrency, WCML\\MultiCurrency\\Resolver\\Reso...PHP message: get_cart was called incorrectly. Adquirir carrito no deber\xc3\xada ser llamado antes de la acci\xc3\xb3n wp_loaded Backtrace: require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_wpml->init, woocommerce_wpml->get_multi_currency, WPML\\Container\\make, call_user_func_array, WPML\\FP\\{closure}, call_user_func_array, WPML\\Container\\{closure}, WPML\\Container\\Container::make, WPML\\Auryn\\Injector->make, WPML\\Auryn\\Injector->provisionInstance, WPML\\Auryn\\Injector->instantiateWithoutCtorParams, WCML_Multi_Currency->__construct, WCML_Multi_Currency->are_filters_need_loading, WCML_Multi_Currency->get_client_currency, WCML\\MultiCurrency\\Resolver\\ComposedResolver->getClientCurrency, call_user_func, WPML\\FP\\{closure}, call_user_func_array, WPML\\FP\\Logic::WPML\\FP\\{closure}, WCML\\MultiCurrency\\Resolver\\ResolverForModeLocation->getClientCurrency, WCML\\MultiCurrency\\Resolver\\Reso...PHP message: get_cart was called incorrectly. Adquirir carrito no deber\xc3\xada ser llamado antes de la acci\xc3\xb3n wp_loaded Backtrace: require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_wpml->init, woocommerce_wpml->get_multi_currency, WPML\\Container\\make, call_user_func_array, WPML\\FP\\{closure}, call_user_func_array, WPML\\Container\\{closure}, WPML\\Container\\Container::make, WPML\\Auryn\\Injector->make, WPML\\Auryn\\Injector->provisionInstance, WPML\\Auryn\\Injector->instantiateWithoutCtorParams, WCML_Multi_Currency->__construct, WCML_Multi_Currency->are_filters_need_loading, WCML_Multi_Currency->get_client_currency, WCML\\MultiCurrency\\Resolver\\ComposedResolver->getClientCurrency, call_user_func, WPML\\FP\\{closure}, call_user_func_array, WPML\\FP\\Logic::WPML\\FP\\{closure}, WCML\\MultiCurrency\\Resolver\\ResolverForModeLocation->getClientCurrency, WCML\\MultiCurrency\\Resolver\\Reso...PHP message: get_cart was called incorrectly. Adquirir carrito no deber\xc3\xada ser llamado antes de la acci\xc3\xb3n wp_loaded Backtrace: require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WCML\\MultiCurrency\\GeolocationFrontendHooks::storeUserCountry, WCML\\MultiCurrency\\Geolocation::getUserCountry, WCML\\MultiCurrency\\Geolocation::getUserCountryByAddress, WC_Customer->__construct, WC_Data_Store->read, WC_Customer_Data_Store_Session->read, WC_Customer_Data_Store_Session->set_defaults, wc_get_customer_default_location, WC_Countries->get_allowed_countries, apply_filters('woocommerce_countries_allowed_countries'), WP_Hook->apply_filters, Cor_Front->cor_product_disable_countries, WC_Cart->get_cart, wc_doing_it_wrong. This message was added in version 2.3.PHP message: get_cart was called incorrectly. Adquirir carrito no deber\xc3\xada ser llamado antes de la acci\xc3\xb3n wp_loaded Backtrace: require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, WCML\\MultiCurrency\\GeolocationFrontendHooks::storeUserCountry, WCML\\MultiCurrency\\Geolocation::getUserCountry, WCML\\MultiCurrency\\Geolocation::getUserCountryByAddress, WC_Customer->__construct, WC_Data_Store->read, WC_Customer_Data_Store_Session->read, WC_Customer_Data_Store_Session->set_defaults, wc_get_customer_default_location, WC_Countries->get_allowed_countries, apply_filters('woocommerce_countries_allowed_countries'), WP_Hook->apply_filters, Cor_Front->cor_product_disable_countries, WC_Cart->get_cart, wc_doing_it_wrong. This message was added in version 2.3.PHP message: PHP Warning: Undefined property: WooCommerce::$payment_gateways in /var/www/vhosts/x.com/httpdocs/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php on line 118', referer: <em><u>hidden link</u></em>
January 10, 2024 at 4:56 pm #15170509

Bigul

Hello,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue.

Please share with us the WordPress debug.log(not WPML debug information) to collect more details on this. Refer to these pages for instructions

https://wpml.org/documentation/support/debugging-wpml/

https://wordpress.org/documentation/article/debugging-in-wordpress/

To enable the WordPress Debug log, open your wp-config.php file of site root and look for define('WP_DEBUG', false);. Change it to:

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
 
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
 
// Disable display of errors and warnings 
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

In this case, the errors will be saved to a debug.log log file inside the */wp-content/* directory. Please do the steps to reproduce the bug and check if you are getting any errors or warnings related to WPML in the log file.

If you can paste your debug.log to http://pastebin.com/index.php and provide me that link it would be great! (This is the cleanest way because sometimes the logs are long and create a complete mess of discussion).

Also, increase the *MaxInputVars* of PHP settings to *10000*. Please check the following article for more details and contact your system admin/hosting provider to upgrade this configuration.

hidden link

--
Thanks!

Bigul

January 10, 2024 at 5:15 pm #15170658

rubenP-11

Hello!

I have already increased the MaxInputVars to 10000.

Here you have the debug.log in pastebin: https://pastebin.com/TR6wXeQN

Thank you so much.

All the best.

January 11, 2024 at 7:41 am #15172384

Bigul

Hello,

Thank you for the updates and Debug log. The Debug log is showing a few notices related to WPML. So we would like to know do you have a staging site(clone copy of the live site). If so, please do the following steps and let us know your feedback.

a) Backup your site first[Mandatory]
b) Switch for a moment to a WordPress default theme like 2023
c) Deactivate all the plugins that are not related to WPML except WooCommerce
d) Then check whether the issue exists or not
e) If the issue is gone, activate the plugins as a group of three or four to find which one has an interaction issue
f) Switch back to the original theme of the site

Also, please visit the WPML>>Languages, settings page and make sure the following options are enabled.

a) Make themes work multilingual>>Adjust IDs for multilingual functionality

b) Language filtering for AJAX operations>>Store a language cookie to support language filtering for AJAX

--
Thanks!

Bigul

January 11, 2024 at 9:48 am #15173235

rubenP-11

Hello,

I have already discovered the plugin that conflicts with the multicurrency, it would be this plugin: hidden link

When I deactivate it, the cart works perfectly.

EDIT: By doing tests I have discovered that the failure is due to the fact that the 2 plugins want to geolocate the client, the multicurrency one to put the relevant currency and the other plugin for its function which is to hide prices.

Trying to deactivate the geolocation of the multi-currency and selecting by site language solves the problem, the problem is that I am interested in the currency being set by geolocation.

I hope this can help you find a solution.

Should I contact them or could WPML have something to do with it?

Thank you so much.

All the best.

January 11, 2024 at 12:19 pm #15174271

Bigul

Hello,

Thank you for the details. It looks like a compatibility issue with the Country Restrictions for WooCommerce plugin. This plugin is not included on the WPML official compatibility list for the Plugins - https://wpml.org/plugin/. It does not mean that this plugin is not compatible with WPML, but our compatibility team has not tested it yet.

So it would be great if you could contact the plugin author and request them to apply for our compatibility program. It will help us to fix the issue. Please refer to the following URL for more details.

https://wpml.org/documentation/support/go-global-program/

--
Thanks!

Bigul

January 15, 2024 at 8:59 am #15183723

rubenP-11

Hello,

Thanks for the information, I have contacted them, if you want I will let you know if they can solve it (I suppose they can, they are good, hahaha) so you can know.

Thank you so much.

All the best.

January 15, 2024 at 9:30 am #15183810

Bigul

Hello,

Thank you for the updates. We will wait for your feedback. It help us a lot in the future. And also hope the plugin authors will contact our compatibility team soon.

--
Thanks!

Bigul

The topic ‘[Closed] Multicurrency activated if I am logged in on the website the cart is emptied’ is closed to new replies.