WooCommerce: Missing Argument 1 for WC_Order::__construct()
September 20, 2014
WooCommerce version 2.2 is a major update. after upgrading the plugin showing Warning as below:
Warning: Missing argument 1 for WC_Order::__construct(), called in /home/public_html/wp-content/plugins/woocommerce-quick-export-plugin/index.php on line 576 and defined in /home/public_html/wp-content/plugins/woocommerce/includes/class-wc-order.php on line 19
Actually this message is showing because some plugin having the code in wrong way like WC_Order
$order = new WC_Order(); $order->populate( $some_var );
And need to be:
$order = new WC_Order( $order_id );
Or better for version 2.2:
$order = wc_get_order( $order_id );
When we upgrade the plugin then WooCommerce Quick Export Plugin having the same issue then we remove the below code
$order = new WC_Order(); $order->populate( $customer_order );
And need to be:
$order = new WC_Order( $customer_order );