How to Enable Customers to Edit Processing Orders in WooCommerce

Want to give your customers the ability to edit orders that are "processing" in WooCommerce? This article will show you to easily add the code to your website.
Share this post:

Have you ever received an email or phone call from a customer asking how they can edit their order after completing it?

Unfortunately, there is no native functionality in WooCommerce to enable your customers to edit processing orders easily.

In this article, we will show you the step-by-step process of adding a custom WooCommerce code snippet to your website that will enable your customers to make edits to their orders that are in the “Processing” status.

How to Edit Processing Orders in WooCommerce

Install & Activate the “Code Snippets” Plugin

The first step in adding the ability for customers to edit processing orders in WooCommerce is to install and activate the Code Snippets WordPress Plugin.

The Code Snippets plugin is fantastic.

It allows you to easily add custom code to your website without editing plugins or themes directly, which can cause critical errors if done incorrectly.

Code Snippets Plugin by Code Snippets Pro

The Code Snippets plugin is free. Here is an easy way to install & activate it on your website:

  • Login to your WordPress Admin Dashboard
  • Go to your “Plugins” tab on the left side of your screen and click “Add New”
  • Click into the “search plugins” input box and add “Code Snippets”
  • Click “Install Now” for the Code Snippets plugin by Code Snippets Pro
  • Then, click “Activate”

Now that you have successfully added the Code Snippets plugin to your website, the next step is creating a new “Snippet” to add the custom code that allows customers to edit processing orders in WooCommerce.

Create a New Snippet Called “Edit Processing Orders in WooCommerce”

This step is straightforward and should only take 1 minute. In your WordPress Admin, you should now see the menu item “Snippets” (which usually appears below “Plugins”).

Once you click into Snippets, you should see a big “Add New” button at the top of your screen. Click that.

Add New Snippet - Edit Processing Orders in WooCommerce

Name your new Snippet, “Edit Processing Orders in WooCommerce”.

Now that you have created an empty Snippet container, you will need to move to the next step to copy and paste the custom code into your snippet.

Copy and Paste the “Edit Processing Orders in WooCommerce” Code into the Snippet

One of the best parts of the WordPress and WooCommerce communities is that there are excellent developers that share their tips and tricks on the internet.

For this custom code snippet, Business Bloomers has kindly written the functionality for anyone to use. Below is the code that Business Bloomers created for you to copy and paste into your new Code Snippet:

 * @snippet       Edit Order Functionality @ WooCommerce My Account Page
 * @how-to        Get FREE
 * @sourcecode
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 4.1
 * @donate $9
// ----------------
// 1. Allow Order Again for Processing Status
add_filter( 'woocommerce_valid_order_statuses_for_order_again', 'bbloomer_order_again_statuses' );
function bbloomer_order_again_statuses( $statuses ) {
    $statuses[] = 'processing';
    return $statuses;
// ----------------
// 2. Add Order Actions @ My Account
add_filter( 'woocommerce_my_account_my_orders_actions', 'bbloomer_add_edit_order_my_account_orders_actions', 50, 2 );
function bbloomer_add_edit_order_my_account_orders_actions( $actions, $order ) {
    if ( $order->has_status( 'processing' ) ) {
        $actions['edit-order'] = array(
            'url'  => wp_nonce_url( add_query_arg( array( 'order_again' => $order->get_id(), 'edit_order' => $order->get_id() ) ), 'woocommerce-order_again' ),
            'name' => __( 'Edit Order', 'woocommerce' )
    return $actions;
// ----------------
// 3. Detect Edit Order Action and Store in Session
add_action( 'woocommerce_cart_loaded_from_session', 'bbloomer_detect_edit_order' );
function bbloomer_detect_edit_order( $cart ) {
    if ( isset( $_GET['edit_order'], $_GET['_wpnonce'] ) && is_user_logged_in() && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), 'woocommerce-order_again' ) ) WC()->session->set( 'edit_order', absint( $_GET['edit_order'] ) );
// ----------------
// 4. Display Cart Notice re: Edited Order
add_action( 'woocommerce_before_cart', 'bbloomer_show_me_session' );
function bbloomer_show_me_session() {
    if ( ! is_cart() ) return;
    $edited = WC()->session->get('edit_order');
    if ( ! empty( $edited ) ) {
        $order = new WC_Order( $edited );
        $credit = $order->get_total();
        wc_print_notice( 'A credit of ' . wc_price($credit) . ' has been applied to this new order. Feel free to add products to it or change other details such as delivery date.', 'notice' );
// ----------------
// 5. Calculate New Total if Edited Order
add_action( 'woocommerce_cart_calculate_fees', 'bbloomer_use_edit_order_total', 20, 1 );
function bbloomer_use_edit_order_total( $cart ) {
  if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return;
  $edited = WC()->session->get('edit_order');
  if ( ! empty( $edited ) ) {
      $order = new WC_Order( $edited );
      $credit = -1 * $order->get_total();
      $cart->add_fee( 'Credit', $credit );
// ----------------
// 6. Save Order Action if New Order is Placed
add_action( 'woocommerce_checkout_update_order_meta', 'bbloomer_save_edit_order' );
function bbloomer_save_edit_order( $order_id ) {
    $edited = WC()->session->get( 'edit_order' );
    if ( ! empty( $edited ) ) {
        // update this new order
        update_post_meta( $order_id, '_edit_order', $edited );
        $neworder = new WC_Order( $order_id );
        $oldorder_edit = get_edit_post_link( $edited );
        $neworder->add_order_note( 'Order placed after editing. Old order number: <a href="' . $oldorder_edit . '">' . $edited . '</a>' );
        // cancel previous order
        $oldorder = new WC_Order( $edited );
        $neworder_edit = get_edit_post_link( $order_id );
        $oldorder->update_status( 'cancelled', 'Order cancelled after editing. New order number: <a href="' . $neworder_edit . '">' . $order_id . '</a> -' );
        WC()->session->set( 'edit_order', null );

Once you’ve copied this code to your computer’s clipboard, you can paste it into your Code Snippet.

Add Edit Processing Orders in WooCommerce Code to Snippet

Then, once that’s complete, “Activate” your new snippet.

Make Sure The Edit Processing Order Functionality is Working Correctly

You’re almost there! The last part is to test your website’s new functionality.

Before having your customers use the “Edit Order” button that is now in the orders tab within their account, make sure everything is working correctly.

When a customer uses the edit processing order functionality, the following should happen:

  • They should see an “Edit Order” button in their Orders tab in their Account
  • When they click the “Edit Order” button, it should add all the previously purchased products to their cart and add a credit for the amount of the order.
  • When the customer completes the new order and checks out, their old order should be canceled, and they should only pay the difference in the total amounts (the value of the new items added)

We hope this new functionality makes your customer’s experience better and your lives, as store owners, easier!

If this tutorial on how to add the functionality “Edit Processing Orders with WooCommerce” to your store worked effectively, please let us know in the comments below!

If you have any questions or need help, please also leave a comment.

Additionally, if you don’t have the time or resources to build, manage, and grow your website, learn about Chairlift’s outsourced web design & development services. We help businesses grow better and faster online with a simple membership.

Share this post:
Gregory Karelitz
Gregory Karelitz

Greg is the founder of Chairlift. He loves creating and building amazing customer experiences online. When he's not behind his screen, you can find him skiing, mountain biking, wakeboarding, or doing some other fun adventure sports.

Articles: 12


  1. Hi there and thanks for the code. Nowhere I have found a solution and you just did it 🙂
    But there are some bugs in here. When the customer clicks on the “edit order” button, just a credit equal to the purchase will be added to his account. The cart will be shown as a new order, not the previous order (for example if the customer has purchased the last item of a product, a warning will be shown that you can not add this item because it is finished!
    I think this is because the previous purchase will be canceled after editing is complete.

  2. Another issue is that if the price of the new order is lower than the previous one, the customer will be the creditor and we owe him some money. But this is not added to his account and the money is gone!

  3. yes, i have the same question as Ali, when click edit order, it just likes copy the order in the cart, but some articles is finished, that will be lost.

Leave a Reply

Your email address will not be published. Required fields are marked *

Schedule a call

Book a time to speak using the calendar below: