我的日志显示了很多以下消息:
order_total was called incorrectly. Order properties should not be accessed directly. This message was added in version 3.0.
它会为订单上的每个属性重复该消息。
这些消息的原因是什么?我应该采取什么措施来纠正它们?
最佳答案
WooCommerce 3.0 修改了代码以限制对属性(property)的直接访问,您可以像下面这样更改代码。
$OrderID= ( WC()->version < '2.7.0' ) ? $order->id : $order->get_id();
$shipping_country = ( WC()->version < '2.7.0' ) ? $order->shipping_country : $order->get_shipping_country();
或者将您的插件更新为兼容 WC3。
$order->property : $order->get_property();
关于php - WooCommerce 3.0 结账期间出现 "properties should not be accessed directly"问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43279193/