woocommerce_new_order action-hookWC 2.7.0

Fires when a new order is created.

Usage

add_action( 'woocommerce_new_order', 'wp_kama_woocommerce_new_order_action', 10, 2 );

/**
 * Function for `woocommerce_new_order` action-hook.
 * 
 * @param int       $order_id Order ID.
 * @param \WC_Order $order    Order object.
 *
 * @return void
 */
function wp_kama_woocommerce_new_order_action( $order_id, $order ){

	// action...
}
$order_id(int)
Order ID.
$order(\WC_Order)
Order object.

Changelog

Since 2.7.0 Introduced.

Where the hook is called

OrdersTableDataStore::create()
woocommerce_new_order
WC_Order_Data_Store_CPT::create()
woocommerce_new_order
WC_Order_Data_Store_CPT::update()
woocommerce_new_order
WC_API_Orders::create_order()
woocommerce_new_order
woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php 1140
do_action( 'woocommerce_new_order', $order->get_id(), $order );
woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php 111
do_action( 'woocommerce_new_order', $order->get_id(), $order );
woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php 195
do_action( 'woocommerce_new_order', $order->get_id(), $order );
woocommerce/includes/legacy/api/v3/class-wc-api-orders.php 505
do_action( 'woocommerce_new_order', $order->get_id() );
woocommerce/includes/legacy/api/v2/class-wc-api-orders.php 465
do_action( 'woocommerce_new_order', $order->get_id() );

Where the hook is used in WooCommerce

Usage not found.