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
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 />
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
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).
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.
> 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.
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.