From d4a02819a704bf1d479d6570a86e64c0d4c50b80 Mon Sep 17 00:00:00 2001 From: Alex James Bishop Date: Thu, 17 Aug 2017 11:31:06 +0930 Subject: [PATCH] Add filter to woocommerce_order_again_button to match WC_Form_Handler->order_again This commit adds the `woocommerce_valid_order_statuses_for_order_again` filter to the conditional check before displaying the order-again button. The purpose is to enable consistency when altering the valid order again statuses - in the past a dev would need to use this filter to let the order through the form handler, and then override the template file for a really trivial reason just to get the button to display. --- includes/wc-template-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index 3eb519a97b5..e71e7025763 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -1900,7 +1900,7 @@ if ( ! function_exists( 'woocommerce_order_again_button' ) ) { * @subpackage Orders */ function woocommerce_order_again_button( $order ) { - if ( ! $order || ! $order->has_status( 'completed' ) || ! is_user_logged_in() ) { + if ( ! $order || ! ! $order->has_status( apply_filters( 'woocommerce_valid_order_statuses_for_order_again', array( 'completed' ) ) ) ) || ! is_user_logged_in() ) { return; }