MdMasud

WordPress, Laravel, Flutter

How to Allow WooCommerce Orders with Custom Statuses to Stay Editable

·

,

By default custom statuses prevent the order from being edited.
WooCommerce only allows editing in a few built-in statuses, but you can override this and allow editing for your own workflow.


Allow Editing in Custom Statuses

add_filter('wc_order_is_editable', 'add_statuses_to_order_be_editable',10, 2);

function add_statuses_to_order_be_editable($editable, $order)
{
    $editable_status = [
        'price-request' => true,
        'pending-pricing' => true,
        'quoted'=> true,
        'customer-visit' => true
    ];

    if ( current_user_can("manage_options")) {
        if ($order && $editable_status[$order->get_status()]) {
            return true;
        }
    }
    return $editable;
}


This allows users with admin rights to edit orders even when they are in one of the custom statuses.


If your order lifecycle requires edits at different steps, enabling edit access for custom statuses ensures your workflow stays smooth.

Comments

Leave a Reply

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