"Properties should not be directly accessible" with WooCommerce 3.0 release

My log shows a lot of messages:

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

and it repeats this message for every property in Order.

What is the reason for these messages and what should I do to fix them?

+1


source to share


1 answer


WooCommerce 3.0 has updated its code to restrict direct access to the resource, you can either change your code as shown 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();

      



Or upgrade your plugins to WC3 compliant.

$ order-> property: $ β†’ order the get _ property ();

+2


source







All Articles