“不应直接访问属性";WooCommerce 3.0 结账期间的问题 [英] "properties should not be accessed directly" issue during WooCommerce 3.0 checkout

查看:20
本文介绍了“不应直接访问属性";WooCommerce 3.0 结账期间的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的日志显示了很多以下消息:

My log show a lot of the following messages:

order_total 被错误调用.不应直接访问订单属性.此消息是在 3.0 版本中添加的.

order_total was called incorrectly. Order properties should not be accessed directly.. This message was added in version 3.0.

它会为 Order 上的每个属性重复该消息.

and it repeats that message for every property on Order.

这些消息的原因是什么,我应该怎么做才能纠正它们?

What is the cause of these messages and what should I do to rectify them?

推荐答案

WooCommerce 3.0 修改了他们的代码以限制对财产的直接访问,您可以像下面那样更改您的代码.

WooCommerce 3.0 revamped their code to restrict the direct access of property, you can either change your code like below.

    $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.

Or Update your plugins to WC3 compatible.

$order->property : $order->get_property();

$order->property : $order->get_property();

这篇关于“不应直接访问属性";WooCommerce 3.0 结账期间的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆