WC_Order_Data_Store_CPT::create()publicWC 1.0

Method to create a new order in the database.

Method of the class: WC_Order_Data_Store_CPT{}

Hooks from the method

Return

null. Nothing (null).

Usage

$WC_Order_Data_Store_CPT = new WC_Order_Data_Store_CPT();
$WC_Order_Data_Store_CPT->create( $order );
$order(WC_Order) (required) (passed by reference — &)
Order object.

WC_Order_Data_Store_CPT::create() code WC 9.4.2

public function create( &$order ) {
	if ( '' === $order->get_order_key() ) {
		$order->set_order_key( wc_generate_order_key() );
	}
	parent::create( $order );

	// Do not fire 'woocommerce_new_order' for draft statuses.
	if ( in_array( $order->get_status( 'edit' ), array( 'auto-draft', 'draft', 'checkout-draft' ), true ) ) {
		return;
	}

	do_action( 'woocommerce_new_order', $order->get_id(), $order );
}