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.

This topic contains 27 replies, has 3 voices.

Last updated by Shekhar Bhandari 3 years, 9 months ago.

Assigned support staff: Shekhar Bhandari.

Author Posts
November 13, 2017 at 11:53 am #1428800

Kristof

I just wanted to create a package with Duplicator as I noticed a huge debug.log file so I took a look inside and it is filled with 13516 hits since Oct 19 for:

[13-Nov-2017 11:37:41 UTC] PHP Fatal error:  Call to a member function get_cart_for_session() on null in /home/tomsgate/public_html/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-cart.php on line 151

We can trace the log back to Oct 19 when we last update the Woocommerce Multilingual plugin
"19-10-2017 07:26.320 Upgraded the plugin WooCommerce Multilingual installed in /home/tomsgate/public_html/wp-content/plugins/woocommerce-multilingual/wpml-woocommerce.php."

17 minute later, the first entry in the debug.log appeared.

November 14, 2017 at 7:05 pm #1430603

Otto
Supporter

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello there,

Welcome to WPML support forum.

Please apologize for the delay in answering. This is not usual in this forum. While one of my teammates takes care of your case I will provide you with the first debugging steps.

Please, delete the debug file (it will be recreated if the error persists), then, if it is possible for you, do the following test:
-Back up your site first
-Deactivate all the plugins that are not related to WPML, keep also WooCommerce and WooCommerce Multilingual
-Switch for a moment to a WordPress default theme like Twenty Fourteen.
-If the issue is gone, activate one by one to see with which one there is an interaction issue

Let us know your results, please.

Kind Regards,

Otto

November 15, 2017 at 2:14 am #1430836

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Could you please let me know if the solution provided by Otto helped you?

Look forward to your reply.

Thanks

November 15, 2017 at 10:33 am #1431150

Kristof

I have followed your steps, but after reactivating all plugins, I cannot reproduce the problem. I have installed Query Monitor so I will keep an eye on this in the next few days.

November 16, 2017 at 1:05 am #1432049

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hi there,

Glad to know the problem is solved, please keep monitoring the site and let us know if you face similar problems in the future, so we can help you further.

Thanks

November 16, 2017 at 8:50 am #1432271

Kristof

We just had a look at the debug.log this morning and the entry was there again. It might seem coincidence, but it looks like it only appears in the WP dashboard or when we go from the WP dashboard to the site and back.
When we browse the frontend, there is no issue or at least, the debug.log is not created.

November 17, 2017 at 2:18 am #1433356

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hi there,

This seems unusual, to further debug this issue, I need to request temporary access (wp-admin and FTP) to your site in order to be of better help. You will find the needed fields for this below the comment area when you log in to leave your next reply. hidden link

This info is private and available to you and supporters only. Read more about this: https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Note that:

#1
Backup (both files and database) your site before giving us your credentials. You can use a plugin for this if you like. I often use the Duplicator plugin for this purpose.
See: http://wordpress.org/plugins/duplicator/

Duplicator instruction
hidden link

#2
It would be better if you give me the test site rather than the live site.

#3
If the issues need some changes in the plugins updates/disabling we will install a plugin called “duplicator” and replicate the site on our local server for testing.

Look forward to your reply.

Thanks

November 20, 2017 at 9:22 am #1435424

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hi there,

I am working on this issue and will respond to you soon.

Thanks

November 20, 2017 at 2:48 pm #1435990

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hi there,

Could you please follow these instructions on your test site or after making a full backup of your site:

Change the code in \woocommerce-multilingual\inc\class-wcml-cart.php, from:


public function cart_switching_currency( $exc, $current_currency, $new_currency, $return = false ) {

    $cart_for_session = WC()->cart->get_cart_for_session();

to:

public function cart_switching_currency( $exc, $current_currency, $new_currency, $return = false ) {
if ( !defined( 'DOING_CRON' ) )
{
        $cart_for_session = WC()->cart->get_cart_for_session();
}

Does this help you to solve the issue?

Look forward to your reply.

Thanks

November 22, 2017 at 10:21 am #1437953

Kristof

Hi,
The get_cart_for_session() error is gone from the debug.log (for now), but the log is still filled with this error. However, I cannot figure out if this is a WPML issue or due to another plugin.

[22-Nov-2017 10:20:11 UTC] PHP Notice:  get_cart was called <strong>incorrectly</strong>. Get cart should not be called before the wp_loaded action. 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, call_user_func_array, woocommerce_wpml->init, WCML_Multi_Currency->__construct, WCML_Multi_Currency->_load_filters, WCML_Multi_Currency->get_client_currency, apply_filters('wcml_switch_currency_exception'), WP_Hook->apply_filters, call_user_func_array, WCML_Cart->cart_switching_currency, WC_Legacy_Cart->get_cart_for_session, WC_Cart_Session->get_cart_for_session, WC_Cart->get_cart, WC_Cart_Session->get_cart_from_session, do_action('woocommerce_cart_loaded_from_session'), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, WC_Cart_Session->set_session, WC_Cart_Session->get_cart_for_session, WC_Cart->get_cart, wc_doing_it_wrong Please see <a href="https://codex.wordpress.org/Debugging_in_WordPres in /home/tomsgate/public_html/wp-includes/functions.php on line 4145
November 23, 2017 at 12:27 am #1438800

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hi there,

To find out if this is related to WPML or not, you can disable WPML once and see if the problem exists. Could you please try this?

Look forward to your reply.

Thanks

November 30, 2017 at 11:23 am #1445707

Kristof

We have disabled all WPML plugins (WPML Multilingual CMS, WPML Media, WPML String Translation and WPML Translation Management) and that PHP notice is now gone.
As a side note, when we only disable the "main" WPML plugin and leave the others enabled there are a lot of entries in the debug.log, but not when we disable them all.

December 1, 2017 at 10:20 am #1446726

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hi there,

I am working on this issue and will respond to you soon.

Thanks

December 1, 2017 at 10:38 am #1446757

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hi there,

Please follow the following steps to solve the issue:
1) Go to WooCommerce->WooCommerce Multilingual -> MultiCurrency -> Automatic Exchange Rates-> Exchange rates source and select any other options rather than Yahoo, Yahoo Finance seems to have discontinued its services and it will be removed in the upcoming releases.

Thanks

December 5, 2017 at 8:14 am #1449299

Kristof

Hi,
this might not be related to the first php error we posted in this ticket, but currently in our debug.log we see 13778 entries since Nov 30 with.
Can you look into this or do you want me to create a new ticket for this?

[05-Dec-2017 08:08:20 UTC] PHP Notice:  get_cart was called <strong>incorrectly</strong>. Get cart should not be called before the wp_loaded action. 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, call_user_func_array, woocommerce_wpml->init, WCML_Multi_Currency->__construct, WCML_Multi_Currency->_load_filters, WCML_Multi_Currency->get_client_currency, apply_filters('wcml_switch_currency_exception'), WP_Hook->apply_filters, call_user_func_array, WCML_Cart->cart_switching_currency, WC_Legacy_Cart->get_cart_for_session, WC_Cart_Session->get_cart_for_session, WC_Cart->get_cart, WC_Cart_Session->get_cart_from_session, do_action('woocommerce_cart_loaded_from_session'), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, WC_Cart_Session->set_session, WC_Cart_Session->get_cart_for_session, WC_Cart->get_cart, wc_doing_it_wrong Please see <a href="https://codex.wordpress.org/Debugging_in_WordPres in /home/tomsgate/public_html/wp-includes/functions.php on line 4146

The topic ‘[Closed] PHP Fatal error: Call to a member function get_cart_for_session()’ is closed to new replies.