I’m trying to put the Order Again button on thankyou page but it doesn’t work, what did I do wrong?
My code on thankyou page
<?php echo esc_url( $order_again_url ); ?>
In my function.php I’m using
add_filter( 'woocommerce_valid_order_statuses_for_order_again', 'add_order_again_status', 10, 1);
function add_order_again_status($array){
$array = array_merge($array, array('on-hold', 'processing', 'pending-payment', 'cancelled', 'refunded'));
return $array;
}
2
Answers
Reorder only allow with order status -> completed.
If you want to reorder on thankyou page so first you should allow status for reorder with on-hold, pending, processing etc..
like this:
Then add reorder button by using woocommerce_thankyou hooks like this:
Note: Reorder button will be visible on buttom of page but If you want Reorder button on any position on thankyou page then you shoult override thankyou page just copy from woocommerce plugin and past inside you active theme -> woocommerce -> thankyou.php and add reorder button accordingly
Reorder button/link for my account page -> order tab like this: