when I create a new order in function.php of the theme using woocommerce plugin
$order = wc_create_order();
It shows me an error as
Fatal error: Call to a member function get_order() on a non-object in ../wc-order-functions.php on line 58
& when I open the file it contains
return WC()->order_factory->get_order( $the_order );
I got the documentation as
$order = wc_create_order();
$order->add_product( get_product( '2319' ), 2 );
$order->set_address( $address, 'billing' );
$order->set_address( $address, 'shipping' );
$order->calculate_totals();
given on github but not working.
Please help me in this.Thanks in advance.