I'm looking to allow the Order Again
functionality to all statuses. By default WooCommerce only allows orders with a status of COMPLETED this functionality. It seems to be a two step process as the first step requires the button being shown to the user, this is completed by editing this file:
wc-template-functions.php
With this snippit of code:
function woocommerce_order_again_button( $order ) {
//if ( ! $order || ! $order->has_status( 'completed' ) || ! is_user_logged_in() ) {
// Allow 'Order Again' at all times.
if ( ! $order || ! is_user_logged_in() ) {
return;
}
wc_get_template( 'order/order-again.php', array(
'order' => $order
) );
}
By commenting out the validation of the $order->has_status()
method, I'm able to show the button on the page. However, when trying clicking the Order Again button, it still does a check before adding the items to the cart.
Can anyone tell me where this code is stored to do a preliminary check on the $order->has_status()
?