woocommerce_valid_order_statuses_for_payment хук-фильтрWC 1.0

Work out if this was for a payment, and trigger a payment_status hook instead.

Использование

add_filter( 'woocommerce_valid_order_statuses_for_payment', 'wp_kama_woocommerce_valid_order_statuses_for_payment_filter', 10, 2 );

/**
 * Function for `woocommerce_valid_order_statuses_for_payment` filter-hook.
 * 
 * @param  $array 
 * @param  $that  
 *
 * @return 
 */
function wp_kama_woocommerce_valid_order_statuses_for_payment_filter( $array, $that ){

	// filter...
	return $array;
}
$array
-
$that
-

Где вызывается хук

WC_Order::status_transition()
woocommerce_valid_order_statuses_for_payment
WC_Order::needs_payment()
woocommerce_valid_order_statuses_for_payment
woocommerce/includes/class-wc-order.php 378
in_array( $status_transition['from'], apply_filters( 'woocommerce_valid_order_statuses_for_payment', array( 'pending', 'failed' ), $this ), true )
woocommerce/includes/class-wc-order.php 1521
$valid_order_statuses = apply_filters( 'woocommerce_valid_order_statuses_for_payment', array( 'pending', 'failed' ), $this );

Где используется хук в WooCommerce

woocommerce/packages/woocommerce-blocks/src/Domain/Services/DraftOrders.php 43
add_filter( 'woocommerce_valid_order_statuses_for_payment', [ $this, 'append_draft_order_post_status' ] );