Wordpress WooCommerce Checkout - SyntaxError: Unexpected token < in JSON at position 0

Wordpress WooCommerce Checkout - SyntaxError: Unexpected token < in JSON at position 0

我们的一个 Wordpress 网站在 WooCommerce结帐页面 上遇到问题。单击 "Place Order" 按钮时会触发错误:

SyntaxError: Unexpected token < in JSON at position 0

这是控制台中显示的错误:

<br />
<b>Fatal error</b>:  Call to a member function update_status() on 
boolean in <b>/home/public_html/wp-
content/plugins/woocommerce/includes/gateways/bacs/class-wc-gateway-
bacs.php</b> on line <b>346</b><br />

有什么想法吗?

调试代码后,我发现我的问题出在数据库的某个地方,订单ID没有正确保存(传递的值始终为0)。我的猜测是某些插件搞砸了我的数据库。

我的数据库关闭了自增功能,所以无法正确保存订单ID,所以出现了第一个[=25]中提到的错误=].

解决方案是修复数据库,方法是在需要的地方添加自动增量,并删除所有带有 0 的条目ID在tablewp_posts.

我遇到了同样的问题,解决了文件夹权限问题。