i have the same problem after I update wordpress to 4.0 and woocommerce to 2.2.2
This message is actually caused because you have some plugin using WC_Order the wrong way.
Probably something like:
$order = new WC_Order();
$order->populate( $some_var );
And need to be:
$order = new WC_Order( $order_id );
Or better for 2.2:
$order = wc_get_order( $order_id );
Hi Claudio
I used your code and it worked for this error, however then I was given a new error related to the populate command. See here :
Fatal error: Call to a member function populate() on a non-object in /home/…./public_html/th…..com/wp-content/themes/theleader/woocommerce/myaccount/my-orders.php on line 44
Do you know what code to add to fix this error?
Thank you in advance, any help is much appreciated!!
I think I need to edit the line $order->populate( $some_var ); to something else to fix this error. Any idea what to edit it to?
Thanks!!
@mccju786 dont’t use the populate() method, use the new wc_get_order() function.
If you want, paste your template code int the pastebin.com and I tell you what to you do to fix it.
Thank you so much!
See here http://pastebin.com/yS6S6ZdU
Let me know what I need to change,
Appreciate it so much
Thanks
Having a similar issue as well after updating to 2.2.2
Seeing this error on the checkout page after item has been purchased
Warning: Missing argument 1 for WC_Order::__construct(), called in /wp-content/plugins/groups-woocommerce/lib/core/class-groups-ws-handler.php on line 287 and defined in /wp-content/plugins/woocommerce/includes/class-wc-order.php on line 19
Warning: Missing argument 1 for WC_Order::__construct(), called in /wp-content/plugins/groups-woocommerce/lib/core/class-groups-ws-handler.php on line 129 and defined in /public_html/wp-content/plugins/woocommerce/includes/class-wc-order.php on line 19
Unfortunately I’m not a plugin developer so am a bit confused.
Thanks
Thread Starter
Mike
(@manndtp)
Changing line 320 in the theme file from
$order = new WC_Order();
to
$order = new WC_Order();
fixed the error showing issue here. Much appreciated.
Sorry mine doesn’t seem to be theme related. It is referencing the groups-woocommerce plugin.
Also the changes you posted are the same line of code. Were they supposed to be different?
Thanks
Hi Claudio
I seemed to have fixed it by replacing
$order = new WC_Order();
$order->populate( $some_var );
with
$order = new WC_Order( $order_id );
Thanks!
Replacing
$order = new WC_Order();
$order->populate( $some_var );
with
$order = new WC_Order( $order_id );
done…
It worked!… at least for now (knowing wordpress, with an incoming future update it might not… who knows)… thanks for the code claudio and mccju for the corroboration.
good to hear rex, such a relief when you find a fix!
Did you need to replace every instance of $order = new WC_Order();
with
$order = new WC_Order( $order_id );
Thanks
Hello, I’m getting the same error after upgrading woocommerce to 2.2:
WARNING: MISSING ARGUMENT 1 FOR WC_ORDER::__CONSTRUCT(), CALLED IN
/HOME/FASHI833/PUBLIC_HTML/WP-CONTENT/THEMES/LABOMBA/WOOCOMMERCE/MYACCOUNT/MY-ORDERS.PHP
ON LINE 42 AND DEFINED IN /HOME/FASHI833/PUBLIC_HTML/WP-CONTENT/PLUGINS/WOOCOMMERCE/INCLUDES/CLASS-WC-ORDER.PHP ON LINE 19
I saw here that the solution that worked for the rest was replacing:
$order = new WC_Order();
$order->populate( $some_var );
with
$order = new WC_Order( $order_id );
Since I’m new to all of this, could you please let me know which .php file do I need to add this to?
Thanks in advance.
Replacing
$order = new WC_Order();
$order->populate( $some_var );
with
$order = new WC_Order( $order_id );
Thank you very much.