WooCommerce Order Status Update showing new shipped status

How to Add a “Shipped” Order Status in WooCommerce

How to Add a “Shipped” Order Status in WooCommerce

Managing orders effectively in WooCommerce involves keeping track of various order statuses from the moment an order is placed until it reaches the customer. WooCommerce provides several default statuses, but customizing your shop to include additional statuses can enhance your workflow significantly. Today, we’re going to walk through the process of adding a new order status called “Shipped” to your WooCommerce store, providing a clearer picture of order progress to both you and your customers.

Why Add a “Shipped” Status?

Adding a “Shipped” status to your WooCommerce orders helps you to:

  • Improve Communication: Customers get real-time updates when their orders are shipped, enhancing customer service.
  • Streamline Operations: Clearly differentiate between orders that are processed and those that are shipped but not yet delivered.
  • Custom Workflow: Tailor the order management process to fit the specific needs of your business and logistics.

Step-by-Step Guide to Implementing a “Shipped” Status

Step 1: Register the New Order Status

To get started, you need to register the new “Shipped” status in WooCommerce’s system. This involves adding some custom code to your theme’s functions.php file or a site-specific plugin.

Here is the code to register the new status:

add_action('init', 'fkwd_register_shipped_order_status');
function fkwd_register_shipped_order_status() {
    register_post_status('wc-shipped', array(
        'label'                     => _x('Shipped', 'Order status', 'woocommerce'),
        'public'                    => true,
        'exclude_from_search'       => false,
        'show_in_admin_all_list'    => true,
        'show_in_admin_status_list' => true,
        'label_count'               => _n_noop('Shipped (%s)', 'Shipped (%s)', 'woocommerce')
    ));
}

This function hooks into WordPress’s initialization process to register a post status with several properties set to integrate smoothly into WooCommerce’s admin interface.

Step 2: Add the “Shipped” Status to WooCommerce

Next, you’ll need to integrate the “Shipped” status into WooCommerce’s list of order statuses to make it usable within the platform:

add_filter('wc_order_statuses', 'fkwd_add_shipped_to_order_statuses');
function fkwd_add_shipped_to_order_statuses($order_statuses) {
    $new_order_statuses = array();
    // Loop through existing statuses and add the new status appropriately
    foreach ($order_statuses as $key => $status) {
        $new_order_statuses[$key] = $status;
        if ('wc-processing' === $key) { // Add after "Processing" status
            $new_order_statuses['wc-shipped'] = _x('Shipped', 'Order status', 'woocommerce');
        }
    }
    return $new_order_statuses;
}

This code snippet filters the list of order statuses in WooCommerce, inserting the “Shipped” status after the “Processing” status. This placement reflects a typical order flow where an order is processed before it is shipped.

Step 3: Add “Shipped” Status to Bulk Actions in WooCommerce

To improve usability, add the “Shipped” status to the bulk actions dropdown in the WooCommerce orders list, enabling you to update multiple orders quickly:

add_filter('bulk_actions-edit-shop_order', 'fkwd_add_shipped_bulk_actions');
function fkwd_add_shipped_bulk_actions($bulk_actions) {
    $bulk_actions['mark_shipped'] = 'Change status to shipped';
    return $bulk_actions;
}

This modification allows you to select multiple orders and mark them as “Shipped” with just a few clicks, streamlining your administrative tasks.

Conclusion

By adding a custom “Shipped” order status to your WooCommerce store, you can better manage your orders. This also improve the communication and satisfaction of your customers. This tweak is a simple yet powerful way to enhance the functionality of your eCommerce platform, making it more tailored to your specific business needs. Remember, when modifying your WooCommerce site, always ensure that you back up your website. Test changes in a staging environment before applying them to your live site.



Leave a Reply

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