Im using this function to add button "Order again" in actions

function cs_add_order_again_to_my_orders_actions( $actions, $order ) {
    $payment_method = method_exists($order, 'get_payment_method') ? $order->get_payment_method() : $order->payment_method;
    if ($payment_method === 'cod') {
        $actions['order-again'] = array(
            'url'  => wp_nonce_url( add_query_arg( 'order_again', $order->id ) , 'woocommerce-order_again' ),
            'name' => __( 'Transformer en commande', 'woocommerce' )

    return $actions;
add_filter( 'woocommerce_my_account_my_orders_actions', 'cs_add_order_again_to_my_orders_actions', 50, 2 );

It works Fine but I want to display it also in View-order page

How I can extract a shortcode to display the button inside "View Order page"

2 Answers 2


have you tried this? add_action( 'woocommerce_view_order', 'cs_add_order_again_to_my_orders_actions', 50, 2 );


Its working by add filter display Options in all status of Orders.

Wooocommerce by default Display the button only in orders Completed

This function will display Options buttons in all orders :

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', 'completed'));
    return $array;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.