Do you want to hide core order statuses in your WooCommerce store?
Recently, a client wanted me to hide some of the order statuses in his WooCommerce store. In this post, you will see how you can easily remove some order statuses and how to create custom ones.
WooCommerce Hide Order Status
For various reasons, you might want to hide some of the core order statuses.
However, the default version of WooCommerce allows you to mark orders with one of the following statuses completed processing, pending payment, on hold, refunded, canceled, or failed.
Many plugins allow you to manage order statuses, and one of them is the ‘WooCommerce Order Status Manager plugin which is priced at $49.
This might be an expensive solution for your store, but there is an easy way to do this.
In the current version of WooCommerce, order statuses are saved as a custom post status, just like the draft, scheduled, or published for posts.
How to Hide Order Status
With that said, let us look at how you can hide order status in WooCommerce using a code snippet.
To check the default order status messages, log into your WordPress site and access the Dashboard as the admin user. Then, click on WooCommerce > Orders. You will see this:
These messages are also displayed on the front end when a customer tries to place an order. This can be accessed by clicking on My Account > Orders, as shown below:
Steps to Hide Core Order Statuses
It is worth mentioning that when you hide core order statuses, make sure that there are no products with that status.
Moreover, you should make sure that your WooCommerce shop does not use that status anywhere, because it can lead to errors.
For example, if you do not plan to make refunds in your WooCommerce store, you can hide the Refund status.
The reason why we cannot remove all the core order statuses is that plugins use order statuses, even the ones you do not use in your workflow.
Plugins like payment gateways, always assume that the core order statuses are present. If they are not there, they will break
Here are the steps that you need to follow:
- Log into your WordPress site and access the Dashboard as the admin user.
- From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file to add the function to hide core order statuses in your WooCommerce store.
- Add the following code to the functions.php file:
/* * Removing core order statuses * @param array $wc_statuses_arr Array of all order statuses on the website */ function njengah_remove_order_statuses( $wc_statuses_arr ){ // Processing if( isset( $wc_statuses_arr['wc-processing'] ) ) { // if exists unset( $wc_statuses_arr['wc-processing'] ); // remove it from array } // Refunded if( isset( $wc_statuses_arr['wc-refunded'] ) ){ unset( $wc_statuses_arr['wc-refunded'] ); } // On Hold if( isset( $wc_statuses_arr['wc-on-hold'] ) ){ unset( $wc_statuses_arr['wc-on-hold'] ); } // Failed if( isset( $wc_statuses_arr['wc-failed'] ) ){ unset( $wc_statuses_arr['wc-failed'] ); } // Pending payment if( isset( $wc_statuses_arr['wc-pending'] ) ){ unset( $wc_statuses_arr['wc-pending'] ); } // Completed //if( isset( $wc_statuses_arr['wc-completed'] ) ){ // unset( $wc_statuses_arr['wc-completed'] ); //} // Cancelled //if( isset( $wc_statuses_arr['wc-cancelled'] ) ){ // unset( $wc_statuses_arr['wc-cancelled'] ); //} return $wc_statuses_arr; // return result statuses } add_filter( 'wc_order_statuses', 'njengah_remove_order_statuses' );
- This is the outcome on the front end:
- To add a custom order status, add the following code in the functions.php file:
/** * Register new status with ID "wc-njengah-shipment" and label "Awaiting shipment" */ function njengah_register_awaiting_shipment_status() { register_post_status( 'wc-njengah-shipment', array( 'label' => 'Awaiting shipment', 'public' => true, 'show_in_admin_status_list' => true, // show count All (12) , Completed (9) , Awaiting shipment (2) ... 'label_count' => _n_noop( 'Awaiting shipment <span class="count">(%s)</span>', 'Awaiting shipment <span class="count">(%s)</span>' ) ) ); } add_action( 'init', 'njengah_register_awaiting_shipment_status' ); /* * Add registered status to list of WC Order statuses * @param array $wc_statuses_arr Array of all order statuses on the website */ function njengah_add_status( $wc_statuses_arr ) { $new_statuses_arr = array(); // add new order status after processing foreach ( $wc_statuses_arr as $id => $label ) { $new_statuses_arr[ $id ] = $label; if ( 'wc-completed' === $id ) { // after "Completed" status $new_statuses_arr['wc-njengah-shipment'] = 'Awaiting shipment'; } } return $new_statuses_arr; // if order status order doesn't matter for you you can remove lines 21-32 and uncomment the following 35-36 // $wc_statuses_arr['wc-njengah-shipment'] = 'Awaiting shipment'; // return $wc_statuses_arr; } add_filter( 'wc_order_statuses', 'njengah_add_status' );
Conclusion
In this post, you have seen how you can hide core order statuses. However, it is important to note that the order status you want to delete is not being used anywhere in your store, because it can lead to errors. Moreover,
I have shared how to add custom order status. If you are not familiar with handling code, please contact a qualified WordPress developer.
Joe is an experienced full-stack web developer with a decade of industry experience in the LAMP & MERN stacks, WordPress, WooCommerce, and JavaScript – (diverse portfolio). He has a passion for creating elegant and user-friendly solutions and thrives in collaborative environments. In his spare time, he enjoys exploring new tech trends, tinkering with new tools, and contributing to open-source projects. You can hire me here for your next project.
Similar Articles
- How to Hide WooCommerce Update Notifications
- How to Customize Storefront Checkout Page
- How to Setup WooCommerce Storefront Blog
- How to Hide Quantity In Stock In WooCommerce
- How to Add WooCommerce Storefront Sitemap
- How to Add WooCommerce Storefront Quantity Discount
- How to Remove, Rename and Add Storefront Sorting Options
- How to Hide Product Tab Title In WooCommerce
- How to Change WooCommerce Product Visibility Options
- How to Hide Product Prices Based on User Role Storefront
- How to Hide Read More and Add to Cart Button WooCommerce
- How to Hide SKU, Category, Tags Meta Product Page WooCommerce
- How to Hide WooCommerce Registration Form
- How to Use WooCommerce Product Attributes Step by Step [Complete Guide]
- How to Remove or Rename Sale Badge WooCommerce Storefront
- How to Rename Order Status Messages in WooCommerce
- How to Remove Cart Page WooCommerce Storefront Theme
- How to Remove Breadcrumbs WooCommerce Storefront
- How to Add Custom Order Status in WooCommerce
- How to Auto Approve Orders in WooCommerce