woocommerce_default_order_status filter-hookWC 3.7.0

Filters the default order status to use when creating a new order.

Usage

add_filter( 'woocommerce_default_order_status', 'wp_kama_woocommerce_default_order_status_filter' );

/**
 * Function for `woocommerce_default_order_status` filter-hook.
 * 
 * @param string $order_status Default order status.
 *
 * @return string
 */
function wp_kama_woocommerce_default_order_status_filter( $order_status ){

	// filter...
	return $order_status;
}
$order_status(string)
Default order status.

Changelog

Since 3.7.0 Introduced.

Where the hook is called

Abstract_WC_Order_Data_Store_CPT::get_post_status()
woocommerce_default_order_status
WC_Abstract_Order::get_status()
woocommerce_default_order_status
woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php 363
$order_status = apply_filters( 'woocommerce_default_order_status', 'pending' );
woocommerce/includes/abstracts/abstract-wc-order.php 403
$status = apply_filters( 'woocommerce_default_order_status', 'pending' );

Where the hook is used in WooCommerce

woocommerce/src/StoreApi/Utilities/OrderController.php 46
add_filter( 'woocommerce_default_order_status', array( $this, 'default_order_status' ) );
woocommerce/src/StoreApi/Utilities/OrderController.php 53
remove_filter( 'woocommerce_default_order_status', array( $this, 'default_order_status' ) );