/**
* Repeat Order for WooCommerce – show "Order Again" button for all statuses.
*
* @see https://www.ads-software.com/plugins/repeat-order-for-woocommerce/
*
* @hooked woocommerce_valid_order_statuses_for_order_again
*
* @param string[] $order_statuses The existing set of statuses whose orders the Order Again button will be shown beside.
*
* @return string[]
*/
function allow_all_order_statuses( array $order_statuses ): array {
$unprefixed_order_statuses = array_map(
function( string $prefixed_status ) {
return str_replace( 'wc-', '', $prefixed_status );
},
array_keys( wc_get_order_statuses() )
);
return $unprefixed_order_statuses;
}
add_filter( 'woocommerce_valid_order_statuses_for_order_again', 'allow_all_order_statuses' );