woocommerce_order_status_(to) action-hookWC 1.0.0

Fires when order status is changed.

Usage

add_action( 'woocommerce_order_status_(to)', 'wp_kama_woocommerce_order_status_to_action', 10, 3 );

/**
 * Function for `woocommerce_order_status_(to)` action-hook.
 * 
 * @param int      $id                Order ID.
 * @param WC_Order $order             Order object.
 * @param array    $status_transition Status transition data.
 *
 * @return void
 */
function wp_kama_woocommerce_order_status_to_action( $id, $order, $status_transition ){

	// action...
}
$id(int)
Order ID.
$order(WC_Order)
Order object.
$status_transition(array)

Status transition data.

  • from(string)
    Order status from.

  • to(string)
    Order status to

  • note(string|false)
    Order note. False will skip adding a note entirely.

  • manual(true|false)
    True if the order is manually changed.

Changelog

Since 1.0.0 Introduced.

Where the hook is called

WC_Order::status_transition()
woocommerce_order_status_(to)
woocommerce/includes/class-wc-order.php 456
do_action( 'woocommerce_order_status_' . $status_transition['to'], $this->get_id(), $this, $status_transition );

Where the hook is used in WooCommerce

woocommerce/includes/emails/class-wc-email-cancelled-order.php 44
add_action( 'woocommerce_order_status_processing_to_cancelled_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-cancelled-order.php 45
add_action( 'woocommerce_order_status_on-hold_to_cancelled_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-customer-cancelled-order.php 45
add_action( 'woocommerce_order_status_processing_to_cancelled_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-customer-cancelled-order.php 46
add_action( 'woocommerce_order_status_on-hold_to_cancelled_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-customer-completed-order.php 42
add_action( 'woocommerce_order_status_completed_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-customer-failed-order.php 42
add_action( 'woocommerce_order_status_failed_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-customer-on-hold-order.php 42
add_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-customer-on-hold-order.php 43
add_action( 'woocommerce_order_status_failed_to_on-hold_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-customer-on-hold-order.php 44
add_action( 'woocommerce_order_status_cancelled_to_on-hold_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-customer-pos-completed-order.php 219
add_action( 'woocommerce_order_status_completed_notification', array( $this, 'auto_trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-customer-processing-order.php 43
add_action( 'woocommerce_order_status_cancelled_to_processing_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-customer-processing-order.php 44
add_action( 'woocommerce_order_status_failed_to_processing_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-customer-processing-order.php 45
add_action( 'woocommerce_order_status_on-hold_to_processing_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-customer-processing-order.php 46
add_action( 'woocommerce_order_status_pending_to_processing_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-failed-order.php 43
add_action( 'woocommerce_order_status_pending_to_failed_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-failed-order.php 44
add_action( 'woocommerce_order_status_on-hold_to_failed_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-new-order.php 43
add_action( 'woocommerce_order_status_pending_to_processing_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-new-order.php 44
add_action( 'woocommerce_order_status_pending_to_completed_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-new-order.php 45
add_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-new-order.php 46
add_action( 'woocommerce_order_status_failed_to_processing_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-new-order.php 47
add_action( 'woocommerce_order_status_failed_to_completed_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-new-order.php 48
add_action( 'woocommerce_order_status_failed_to_on-hold_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-new-order.php 49
add_action( 'woocommerce_order_status_cancelled_to_processing_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-new-order.php 50
add_action( 'woocommerce_order_status_cancelled_to_completed_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/emails/class-wc-email-new-order.php 51
add_action( 'woocommerce_order_status_cancelled_to_on-hold_notification', array( $this, 'trigger' ), 10, 2 );
woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php 195
add_action( 'woocommerce_order_status_processing', array( $this, 'capture_payment' ) );
woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php 196
add_action( 'woocommerce_order_status_completed', array( $this, 'capture_payment' ) );
woocommerce/includes/tracks/events/class-wc-orders-tracking.php 22
add_action( 'woocommerce_order_status_changed', array( $this, 'track_order_status_change' ), 10, 3 );
woocommerce/includes/wc-order-functions.php 1068
add_action( 'woocommerce_order_status_pending', 'wc_update_coupon_usage_counts' );
woocommerce/includes/wc-order-functions.php 1069
add_action( 'woocommerce_order_status_completed', 'wc_update_coupon_usage_counts' );
woocommerce/includes/wc-order-functions.php 1070
add_action( 'woocommerce_order_status_processing', 'wc_update_coupon_usage_counts' );
woocommerce/includes/wc-order-functions.php 1071
add_action( 'woocommerce_order_status_on-hold', 'wc_update_coupon_usage_counts' );
woocommerce/includes/wc-order-functions.php 1072
add_action( 'woocommerce_order_status_cancelled', 'wc_update_coupon_usage_counts' );
woocommerce/includes/wc-order-functions.php 1073
add_action( 'woocommerce_order_status_failed', 'wc_update_coupon_usage_counts' );
woocommerce/includes/wc-order-functions.php 494
add_action( 'woocommerce_order_status_completed', 'wc_downloadable_product_permissions' );
woocommerce/includes/wc-order-functions.php 495
add_action( 'woocommerce_order_status_processing', 'wc_downloadable_product_permissions' );
woocommerce/includes/wc-order-functions.php 928
add_action( 'woocommerce_order_status_refunded', 'wc_order_fully_refunded' );
woocommerce/includes/wc-order-functions.php 992
add_action( 'woocommerce_order_status_completed', 'wc_update_total_sales_counts' );
woocommerce/includes/wc-order-functions.php 993
add_action( 'woocommerce_order_status_processing', 'wc_update_total_sales_counts' );
woocommerce/includes/wc-order-functions.php 994
add_action( 'woocommerce_order_status_on-hold', 'wc_update_total_sales_counts' );
woocommerce/includes/wc-order-functions.php 995
add_action( 'woocommerce_order_status_completed_to_cancelled', 'wc_update_total_sales_counts' );
woocommerce/includes/wc-order-functions.php 996
add_action( 'woocommerce_order_status_processing_to_cancelled', 'wc_update_total_sales_counts' );
woocommerce/includes/wc-order-functions.php 997
add_action( 'woocommerce_order_status_on-hold_to_cancelled', 'wc_update_total_sales_counts' );
woocommerce/includes/wc-stock-functions.php 125
add_action( 'woocommerce_order_status_completed', 'wc_maybe_reduce_stock_levels' );
woocommerce/includes/wc-stock-functions.php 126
add_action( 'woocommerce_order_status_processing', 'wc_maybe_reduce_stock_levels' );
woocommerce/includes/wc-stock-functions.php 127
add_action( 'woocommerce_order_status_on-hold', 'wc_maybe_reduce_stock_levels' );
woocommerce/includes/wc-stock-functions.php 155
add_action( 'woocommerce_order_status_cancelled', 'wc_maybe_increase_stock_levels' );
woocommerce/includes/wc-stock-functions.php 156
add_action( 'woocommerce_order_status_pending', 'wc_maybe_increase_stock_levels' );
woocommerce/includes/wc-stock-functions.php 488
add_action( 'woocommerce_order_status_cancelled', 'wc_release_stock_for_order', 11 );
woocommerce/includes/wc-stock-functions.php 489
add_action( 'woocommerce_order_status_completed', 'wc_release_stock_for_order', 11 );
woocommerce/includes/wc-stock-functions.php 490
add_action( 'woocommerce_order_status_processing', 'wc_release_stock_for_order', 11 );
woocommerce/includes/wc-stock-functions.php 491
add_action( 'woocommerce_order_status_on-hold', 'wc_release_stock_for_order', 11 );
woocommerce/includes/wc-user-functions.php 395
add_action( 'woocommerce_order_status_completed', 'wc_paying_customer' );
woocommerce/src/Admin/Features/Fulfillments/FulfillmentsSettings.php 19
add_action( 'woocommerce_order_status_processing', array( $this, 'auto_fulfill_items_on_processing' ), 10, 2 );
woocommerce/src/Admin/Features/Fulfillments/FulfillmentsSettings.php 20
add_action( 'woocommerce_order_status_completed', array( $this, 'auto_fulfill_items_on_completed' ), 10, 2 );
woocommerce/src/Caches/OrderCountCacheService.php 49
add_action( 'woocommerce_order_status_changed', array( $this, 'update_on_order_status_changed' ), 10, 4 );
woocommerce/src/Internal/Admin/Agentic/AgenticWebhookManager.php 71
add_action( 'woocommerce_order_status_changed', array( $this, 'handle_order_status_changed' ), 10, 4 );
woocommerce/src/Internal/Caches/OrdersVersionStringInvalidator.php 71
add_action( 'woocommerce_order_status_changed', array( $this, 'handle_woocommerce_order_status_changed' ), 10, 4 );
woocommerce/src/Internal/OrderReviews/Scheduler.php 58
add_action( 'woocommerce_order_status_completed', array( $this, 'handle_woocommerce_order_status_completed' ), 10, 1 );
woocommerce/src/Internal/OrderReviews/Scheduler.php 63
add_action( 'woocommerce_order_status_changed', array( $this, 'handle_status_changed' ), 10, 3 );
woocommerce/src/Internal/PushNotifications/Triggers/NewOrderNotificationTrigger.php 53
add_action( 'woocommerce_order_status_changed', array( $this, 'on_order_status_changed' ), 10, 4 );