Skip to content
Advertisement

“WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong” WooCommerce error

My function causes error «WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong». I’ve learned about same issues but still can’t find where in my function wrong calls are, please help.

Woocommerce 4.3.

Here’s the function:

JavaScript

Advertisement

Answer

Since WooCommerce 3 Object properties can’t be accessed directly, instead you will use WC_Order methods. So in your code, replace

  • $order->status by $order->get_status()
  • $order->total by $order->get_total()

It should solve your issue.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement