Allow customers to edit already placed orders

Do your customers feel confident when they buy from your WooCommerce store? Do they know your customer support is as good as the support they would get face-to-face in a brick and mortar store?

One of the reasons people might not feel comfortable buying things online, is the fear that, if they change their mind after the order is placed, there is very little they can do. Contacting the seller might feel daunting, they can’t be sure someone will address their concerns quickly.
How much better would it be, in terms of user experience, if your customers had the ability to edit their already placed order, as long as the order hasn’t shipped yet?

In this guide, we will see how we can achieve just this:
 

Understanding order status in WooCommerce

First of all, let’s make clear that not every order can be edited. WooCommerce has multiple order statuses, that you can review here: WooCommerce Docs – Order Statuses. An already placed order is only editable if the status is “On Hold” or “Pending Payment”, by default. The reason for this is that the customer might have already deposited the payment, and, having the ability to edit orders will create complications with payment processing.

However, there are very good reasons to want to edit an already placed order. Say, the customer ordered a yellow t-shirt, but then they realize that they want a red one instead. The variations have the same price, the order has not been shipped yet, there is really no reason not to allow your customers to edit their preference.

So, let’s add the ability to edit orders that have already been paid for and are in “Processing” status.
 

Getting ready

Before doing any code modifications, it’s always a good idea to take a full backup of our site and make sure that we have FTP access or access to cPanel or Plesk or other control panel with access to a file manager.

If you wonder what is the best way to add code snippets to your site, have a look at our previous article about safely adding PHP code.
 

Making “Processing” orders editable

We will add a very simple filter, that will make orders in “Processing” status to be editable:

add_filter( 'wc_order_is_editable', 'wc_make_processing_orders_editable', 10, 2 );
 function wc_make_processing_orders_editable( $is_editable, $order ) {
    if ( $order->get_status() == 'processing' ) {
        $is_editable = true;
    }
    return $is_editable;
}

 

Result

Before, customer sees a message that this order is no longer editable:

But after adding the snippet above, the customer can edit the order:

 

A word of caution:

Adding this feature is better suited for stores that accept payment on delivery, or that send an invoice. If your customer pays immediately, giving them the ability to and add or remove items in an already paid order, might cause problems, as they will need to re-process the payment.

Leave a Reply