Reserve Your Free Seat for Our Next WooCommerce Class! Search
Business Bloomer
  • Business Bloomer Club
  • WooCommerce Plugins
  • WooCommerce Tips
  • Log In
  • 0
  • Business Bloomer Club
  • WooCommerce Plugins
  • WooCommerce Tips
  • Log In
  • Search
  • Contact
  • Cart
WooCommerce Code Snippets My Account Order Order Status

WooCommerce: Hide Specific Orders (e.g. On Hold) From My Account Orders Page

Last Revised: Jan 2023

STAY UPDATED

The customer’s WooCommerce My Account Orders page displays all their orders, no matter the “status” (completed, processing, on-hold, pending, etc.).

It may happen that you, as a WooCommerce store manager, need to hide certain orders, for example the “on-hold” ones, or all orders with a custom order status.

Thankfully, this is very easy with a few lines of PHP. Enjoy!

In this example, I’d like to hide all “On hold” orders from the customer My Account page

PHP Snippet: Hide Specific Order Status @ My Account Orders Page

/**
 * @snippet       Hide Orders @ WooCommerce My Account
 * @how-to        businessbloomer.com/woocommerce-customization
 * @author        Rodolfo Melogli, Business Bloomer
 * @compatible    WooCommerce 7
 * @community     https://businessbloomer.com/club/
 */

add_filter( 'woocommerce_my_account_my_orders_query', 'bbloomer_exclude_status', 9999 );

function bbloomer_exclude_status( $args ) {
	$statuses = wc_get_order_statuses();
	unset( $statuses['wc-on-hold'] ); // wc-completed, wc-processing, etc.
	$args['status'] = array_keys( $statuses );
	return $args;
}

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: Separate Login, Registration, My Account Pages
    There are times when you need to send logged out customers to a Login page and unregistered customers to a standalone Register page. As you…
  • WooCommerce: Add New Tab @ My Account Page
    One of the features of Business Bloomer Club is the provision of Premium WooCommerce Q&A Support to supporters who enroll. So, how to add an…
  • WooCommerce: How To Make A Website GDPR Compliant? (12 Steps)
    Ok, we all know that the EU General Data Protection Regulation (GDPR) will come into force on the 25th May 2018. So the main question…
  • WooCommerce: How to Add a Custom Checkout Field
    Let’s imagine you want to add a custom checkout field (and not an additional billing or shipping field) on the WooCommerce Checkout page. For example,…
  • WooCommerce: Get Order Data (total, items, etc) From $order Object
    As a WooCommerce development freelancer, every day I repeat many coding operations that make me waste time. One of them is: “How to get ____…

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

4 thoughts on “WooCommerce: Hide Specific Orders (e.g. On Hold) From My Account Orders Page”

  1. Ivan
    October 12, 2023

    And to use this on the Admin Orders pages to temporarily hide orders cancelled and completed..

    Ideal if we could also put a tick up top to be able to de-activate it too..

    Reply
    1. Rodolfo Melogli
      October 14, 2023

      Hello Ivan, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  2. bola
    January 11, 2023

    Error on code:

    add_filter( ‘woocommerce_my_account_my_orders_query’, ‘bbloomer_exclude_status, 9999 );

    must be

    add_filter( ‘woocommerce_my_account_my_orders_query’, ‘bbloomer_exclude_status’, 9999 );

    Reply
    1. Rodolfo Melogli
      January 13, 2023

      Thanks a lot, fixed!

      Reply
Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Cancel reply

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


Search WooCommerce Tips

Popular Searches: Visual Hook Guides - Checkout Page - Cart Page - Single Product Page - Add to Cart - Emails - Shipping - Prices - Hosting

Recent Articles

  • WooCommerce: Redirect Empty Paginated Category Pages (404)
  • WooCommerce: Complete Button @ Order Admin
  • WooCommerce: Allow Guest Checkout For Existing Customers
  • WooCommerce: Simplify Free Checkout
  • WooCommerce: Inject Ad After the nth Product @ Shop Page

Latest Comments

  1. Rodolfo Melogli on WooCommerce: Prevent Duplicate Orders
  2. Rodolfo Melogli on WooCommerce: Remove “Get the app” Ad @ Admin Order Emails
  3. Rodolfo Melogli on WooCommerce: Failed Orders Monitor & Temporary Lockdown

Find Out More

  • Become a WooCommerce Expert
  • Business Bloomer Club
  • WooCommerce Blog
  • WooCommerce Weekly
  • Contact

Contact Info

Ciao! I'm Rodolfo Melogli, an Italian Civil Engineer who has turned into an international WooCommerce expert. You can contact me here:

Twitter: @rmelogli

Get in touch: Contact Page

Business Bloomer © 2011-2025 - VAT IT02722220817 - Terms of Use - Privacy Policy

Cart reminder?

x