Enable “Order Again” in WooCommerce My Orders

Ajax Ajax Wordpress Code Snippets E-Commerce Tips PHP Debugging PHP Snippets Woocommerce WooCommerce Custom Code Woocommerce Hooks WooCommerce Tips Wordpress WordPress Development

Enable “Order Again” in WooCommerce My Orders Tutorial/Guide

Help your users reorder past purchases easily by adding an "Order Again" button on the WooCommerce My Account → Orders page. Great for user experience and conversions.

Why Use an "Order Again" Button?

This feature is ideal for stores where users frequently purchase the same items. It reduces the time they spend navigating and encourages repeat orders with one click.

How to Implement

Here’s a quick 2-step process to activate this feature on your WooCommerce store.

Step 1: Add PHP Snippet

Insert the following code into your functions.php or a site-specific plugin:

function custom_add_order_again_button($order_id) {
    $order = wc_get_order($order_id);
    
    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: Test the Button

Visit your WooCommerce My Account area. For any completed or processing order, a new "Order Again" button will now be visible, allowing one-click reordering.

Tips

This only works for orders with a status of completed or processing. Want to go further? Use filters to add conditions or styling as needed.  

💡 Have a Coding Problem?

Search our archives or reach out to our team for solutions and expert advice.