Add an “Order Again” Button to WooCommerce My Account Orders

Add an “Order Again” Button to WooCommerce My Account Orders

Adding an “Order Again” button to your WooCommerce My Account Orders page lets customers quickly reorder products. This feature improves the shopping experience and boosts customer satisfaction by making repeat orders more convenient.

Why Add an “Order Again” Button?

The “Order Again” button is especially useful for items that customers buy frequently, as it saves them time by allowing them to add past orders to their cart with just one click. This tutorial shows how to implement this feature easily in WooCommerce.

How to Add the “Order Again” Button

To add the “Order Again” button to your WooCommerce My Account Orders page, follow these steps:

Step 1: Add the Custom Function

Include this custom function in your theme’s functions.php file or a custom plugin:

// Add "Order Again" button to the "My Account > Orders" page
function custom_add_order_again_button($order_id)
{
    $order = wc_get_order($order_id);

    // Check if the order is valid and if it is "completed" or "processing"
    if ($order && in_array($order->get_status(), array('completed', 'processing'))) {
        $order_again_url = wc_get_cart_url() . '?order_again=' . $order_id;

        echo '<a href="' . esc_url($order_again_url) . '" class="button order-again">' . __('Order Again', 'woocommerce') . '</a>';
    }
}
add_action('woocommerce_my_account_my_orders_actions', 'custom_add_order_again_button');

Step 2: Save and Test

After saving your changes, go to My Account > Orders on your WooCommerce site to check the new “Order Again” button. It should now appear next to each completed or processing order, allowing customers to reorder items with ease.

Important Notes

The “Order Again” button will only appear for orders with a “completed” or “processing” status. This ensures that customers can only reorder items that have been successfully purchased and processed previously.

If you’d like to customize further or add more criteria, consider using plugins or advanced customizations to meet specific requirements.

Scroll to Top

Request A Quote