Skip Navigation

[Resolved] [BUG][CRED Commerc] Uncaught Error: Call to undefined method WC_Order::get_id()

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 7 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#531118

When I hit the submit button on a WooCommerce checkout page then the following error appears:

"SyntaxError: Unexpected token < in JSON at position 0" displayed by WooCommerce.

The error is caused by CRED Commerce plugin trying to call an unexisting

WC_Order::get_id()

method.

I can see the following errors in the AJAX response:

<br />
<b>Fatal error</b>:  Uncaught Error: Call to undefined method WC_Order::get_id() in /var/www/clients/client2/web71/web/wp-content/plugins/cred-commerce/plugins/woocommerce/CRED_Woocommerce.php:262
Stack trace:
#0 /var/www/clients/client2/web71/web/wp-content/plugins/cred-commerce/classes/Form_Handler.php(167): CRED_Woocommerce_Plugin->getCustomer(552443, 34371)
#1 /var/www/clients/client2/web71/web/wp-content/plugins/cred-commerce/classes/Form_Handler.php(242): CRED_Commerce_Form_Handler->getCustomer(552443, 34371)
#2 /var/www/clients/client2/web71/web/wp-content/plugins/cred-commerce/classes/Plugin_Base.php(47): CRED_Commerce_Form_Handler->onOrderCreated(Array)
#3 /var/www/clients/client2/web71/web/wp-content/plugins/cred-commerce/plugins/woocommerce/CRED_Woocommerce.php(199): CRED_Commerce_Plugin_Base->dispatch('_cred_order_cre...', Array)
#4 /var/www/clients/client2/web71/web/wp-includes/class-wp-hook.php(300): CRED_Woocommerce_Plugin->onCheckout(552446)
#5 /var/www/clients/client2/web71/web/wp-includes/class-wp-hook.php(323): in <b>/var/www/clients/client2/web71/web/wp-content/plugins/cred-commerce/plugins/woocommerce/CRED_Woocommerce.php</b> on line <b>262</b><br />
#531192

Dear lapala,

I can not duplicate same problem with the latest version of plugins in a fresh wordpress installation, please check these in your website:
1) You are using the latest version of CRED + CRED Commerce + Woocommerce plugins
2) deactivate other plugins and switch to wordpress default theme, and test again

#531849

I've been using the latest WooCommerce version from the 2.x branch. I've updated WooCommerce to the 3.x version and it works fine now.

But IMO you shouldn't drop backwards compatibility. A lot of users still use the 2.x version and they can't update because of various reasons (for example incompatibility issues with their themes and other Woo plugins).

#532584

I assume the problem occurs when you are using the latest version of CRED Commerce plugin + old version of Woocommerce plugin, and it will conduct the problem you mentioned above, you will need to use the latest version of CRED Commerce plugin + Woocommerce,
Or both old version of CRED Commerce plugin + Woocommerce.

#532898

> I assume the problem occurs when you are using the latest version of CRED Commerce plugin + old version of Woocommerce plugin,

Yes. You're right.

> you will need to use the latest version of CRED Commerce plugin + Woocommerce, Or both old version of CRED Commerce plugin + Woocommerce.

I understand. This is what I didn and it solved the problem.

But IMO dropping backward compatibility shouldn't happend without letting users know. I was able to debug the issue, but I'm afraid that the majority of Toolset users wouldn't be able to do it.

You should at least mention this fact in the changelog.

#533082

It is not recommended to use the old version of Wocommerce plugin with the latest version of CRED commerce plugin, it will conduct some unexpected results, Thanks for the feedback, I forward the backward compatibility request to our editor, hope they can add it into the change log.

The forum ‘Types Community Support’ is closed to new topics and replies.