get_cart was called incorrectly Errors since 2.5.0
-
Hi there,
Since installing 2.5.0 I am getting this error:
PHP message: get_cart was called incorrectly. 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, WC_Braintree->maybe_init_apple_pay, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Plugin->maybe_init_apple_pay, WC_Braintree->build_apple_pay_instance, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->__construct, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->is_available, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->is_available, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->get_accepted_currencies, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->get_processing_gateway, SkyVerge\\WooComm...
I do not use Apple Pay.
Would appreciate a fix.
Jason
- This topic was modified 3 years, 8 months ago by Jason.
-
Hi Jason! ( @galapogos01 )
Nik here from SkyVerge support, thanks for reaching out about our Braintree for WooCommerce plugin. I’m happy to help!
Thanks for sharing that error message! I’m looking into this message to get a better idea of what might be causing the issue.
For context, could you tell me when this error is occurring? Is it on a certain page, or as soon as you update the plugin?
All the best,
Nik
SkyVergeI have the same error on my website.
Notice: get_cart was called incorrectly. 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, WC_Braintree->maybe_init_apple_pay, SkyVerge\WooCommerce\PluginFramework\v5_10_5\SV_WC_Payment_Gateway_Plugin->maybe_init_apple_pay, WC_Braintree->build_apple_pay_instance, SkyVerge\WooCommerce\PluginFramework\v5_10_5\SV_WC_Payment_Gateway_Apple_Pay->__construct, SkyVerge\WooCommerce\PluginFramework\v5_10_5\SV_WC_Payment_Gateway_Apple_Pay->is_available, SkyVerge\WooCommerce\PluginFramework\v5_10_5\Payment_Gateway\External_Checkout\External_Checkout->is_available, SkyVerge\WooCommerce\PluginFramework\v5_10_5\SV_WC_Payment_Gateway_Apple_Pay->get_accepted_currencies, SkyVerge\WooCommerce\PluginFramework\v5_10_5\Payment_Gateway\External_Checkout\External_Checkout->get_processing_gateway, SkyVerge\WooCommerce\Plu in /var/www/xxxxxxxxxxxxxx/wp-includes/functions.php on line 5311
- This reply was modified 3 years, 8 months ago by hrvojea.
It was happening on every page @nikskyverge – I had to downgrade to keep my site error free.
I see other reports at https://www.ads-software.com/support/topic/recurring-message-in-php_errorlog/
Cheers,
Jason- This reply was modified 3 years, 8 months ago by Jason.
Hey there @galapogos01 and @hrvojea,
Thanks so much for the additional info here!
As you mentioned Jason, we’ve seen some reports of similar errors recently, although these appeared to be due to conflicts caused by other plugins on those sites. That said, given that we’ve had multiple of these reports crop up, I’d like to review the issue with our engineering team to make sure there isn’t something on our end being missed.
Jason ( @galapogos01 ), the error message you shared specifically seems to be cut off at the end there (
>get_processing_gateway, SkyVerge\\WooComm...
). Would you be able to share that full message again, or perhaps just the last bit so we can be sure we’re working with the correct information?Thanks again!
@nikskyverge I’ll paste the whole line from the error log however it appears the truncation is occurring due to the massive class dependency chain as it’s truncated within the error entry. Happy to get any other debug data needed.
[Wed Mar 24 21:20:08.653236 2021] [proxy_fcgi:error] [pid 1577:tid 140334147507968] [client 66.249.64.172:0] AH01071: Got error 'PHP message: get_cart was called incorrectly. 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, WC_Braintree->maybe_init_apple_pay, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Plugin->maybe_init_apple_pay, WC_Braintree->build_apple_pay_instance, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->__construct, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->__construct, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->init, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->get_processing_gateway, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->get_suppor...PHP message: get_cart was called incorrectly. 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, WC_Braintree->maybe_init_apple_pay, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Plugin->maybe_init_apple_pay, WC_Braintree->build_apple_pay_instance, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->__construct, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->__construct, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->init, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->get_processing_gateway, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->get_suppor...PHP message: get_cart was called incorrectly. 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, WC_Braintree->maybe_init_apple_pay, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Plugin->maybe_init_apple_pay, WC_Braintree->build_apple_pay_instance, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->__construct, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->__construct, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->init, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->get_processing_gateway, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->get_suppor...PHP message: get_cart was called incorrectly. 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, WC_Braintree->maybe_init_apple_pay, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Plugin->maybe_init_apple_pay, WC_Braintree->build_apple_pay_instance, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->__construct, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->__construct, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->init, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->get_processing_gateway, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->get_suppor...PHP message: get_cart was called incorrectly. 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, WC_Braintree->maybe_init_apple_pay, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Plugin->maybe_init_apple_pay, WC_Braintree->build_apple_pay_instance, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->__construct, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->__construct, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->init, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->get_processing_gateway, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->get_suppor...PHP message: get_cart was called incorrectly. 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, WC_Braintree->maybe_init_apple_pay, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Plugin->maybe_init_apple_pay, WC_Braintree->build_apple_pay_instance, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->__construct, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->is_available, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->is_available, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->is_configured, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->is_configured, SkyVerge\\WooCommerce\\PluginFramewor...PHP message: get_cart was called incorrectly. 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, WC_Braintree->maybe_init_apple_pay, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Plugin->maybe_init_apple_pay, WC_Braintree->build_apple_pay_instance, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->__construct, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->is_available, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->is_available, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\SV_WC_Payment_Gateway_Apple_Pay->get_accepted_currencies, SkyVerge\\WooCommerce\\PluginFramework\\v5_10_5\\Payment_Gateway\\External_Checkout\\External_Checkout->get_processing_gateway, SkyVerge\\WooComm...', referer: https://
Cheers,
JasonWe are running Woocommerce Subscription site. Error log is 200mb right now all due to the same error. pasting here
[06-Apr-2021 17:46:38 UTC] get_cart was called incorrectly. Get basket 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, WC_Braintree->maybe_init_apple_pay, SkyVerge\WooCommerce\PluginFramework\v5_10_5\SV_WC_Payment_Gateway_Plugin->maybe_init_apple_pay, WC_Braintree->build_apple_pay_instance, SkyVerge\WooCommerce\PluginFramework\v5_10_5\SV_WC_Payment_Gateway_Apple_Pay->__construct, SkyVerge\WooCommerce\PluginFramework\v5_10_5\SV_WC_Payment_Gateway_Apple_Pay->is_available, SkyVerge\WooCommerce\PluginFramework\v5_10_5\Payment_Gateway\External_Checkout\External_Checkout->is_available, SkyVerge\WooCommerce\PluginFramework\v5_10_5\SV_WC_Payment_Gateway_Apple_Pay->get_accepted_currencies, SkyVerge\WooCommerce\PluginFramework\v5_10_5\Payment_Gateway\External_Checkout\External_Checkout->get_processing_gateway, SkyVerge\WooCommerce\PluginFramework\v5_10_5\Payment_Gateway\External_Checkout\External_Checkout->get_supporting_gateways, WC_Payment_Gateways->get_available_payment_gateways, apply_filters('woocommerce_available_payment_gateways'), WP_Hook->apply_filters, Alg_WC_PGPP_Core->filter_available_payment_gateways_per_category, Alg_WC_PGPP_Core->do_disable_gateway_by_terms, WC_Cart->get_cart, wc_doing_it_wrong. This message was added in version 2.3.
Hi folks! @joldeski @galapogos01 @hrvojea
Thanks for the additional error info here!
We are still digging into this on our end and I’d just like to clarify a couple points to make sure we’re focusing our efforts correctly.
Could you please let me know if this is only occurring with the most recent Braintree for WooCommerce release (v 2.5.0)? And do any of you have any other payment gateways active on your sites?
All the best,
Nik
SkyVergeHi Nik,
We are on latest version of your plugin (and all other plugins we have) together with latest WordPress and Woo.
We are also using only WooCommerce GoCardless Gateway. We are running Woocommerce Subscription plugin which today has a new update, but that was not the case yesterday.
This started after updates on [22-Mar-2021 18:22:11 UTC]
Hey there,
Thanks @joldeski for letting me know!
It would also help us to know which version folks are reverting back to in order to prevent these error messages.
Jason ( @galapogos01 ), I know you had mentioned downgrading specifically before. Could you let me know which version of the plugin you’ve downgraded to?
Cheers,
NikHi Nik. I don`t know the version of the plugin, but I know the date errors start popping up. So whatever version was before 22 March it was ok I suppose. We update the site regulary (almost every week)
We have not downgrade the plugin. The plugin seams to be still working. its just I have to delete like 600mb of logs every day.
Hi all! ( @joldeski @galapogos01 @hrvojea )
Quick update here: we’ve been able to replicate this issue on our end and our engineers are working on a solution. For context, this appears to be an incompatibility issue that comes up when running Braintree alongside other payment gateways which is causing these errors when our plugin checks to see if Apple Pay should be initialized.
While we are working on a more permanent solution, you should be able to prevent these errors in the meantime by disabling Braintree’s Apple Pay initialization using the following filter:
add_filter( 'wc_payment_gateway_braintree_activate_apple_pay', '__return_false', 11, 1 );
I should note that a customization like this is not covered under our support policy, so we won’t be able to help with implementation directly. However, if you aren’t sure how to add custom code to your site, we do have this blog article that walks through some popular options.
If you aren’t able to implement that filter, or don’t want to disable Apple Pay on your site, the plugin should continue functioning despite the errors in the meantime and we’ll be sure to update here when we have a fix.
Cheers,
Nik
SkyVerge@nikskyverge I downgraded to 2.4.3
I am running the Afterpay and Zip plugins – neither have Apple Pay functionality.
With Braintree downgraded I do not get any errors (all other plugins remaining the same).
Happy to provide any further info or test any hotfix release but would appreciate a fix release asap!
Thanks,
JasonHi Nik. Thanks for the filter. Working fine with me. No error logs for apple pay
Hi there!
@joldeski , thanks for confirming the snippet is working for you in the meantime, glad to hear it!
@galapogos01 , thanks for the additional details here! Our developers are working on this at the moment and while I don’t have an exact release date, I can see the patch is now under review. As long as no serious issue is found during testing, we’ll hopefully have a new fix out soon!.
Thanks again for your patience!
Nik
SkyVergeHi All! ( @joldeski @galapogos01 @hrvojea )
Writing back to let you know that we just released v2.6.0 of the plugin which includes a fix for this issue.
Thanks so much for bringing this to our attention!
Would you let me know if you’re able to update to the latest release and confirm that this has resolved the errors you were seeing on your site?
Cheers!
Nik
SkyVerge
- The topic ‘get_cart was called incorrectly Errors since 2.5.0’ is closed to new replies.