Reset menu_order of WooCommerce products in phpMyAdmin

The Problem

At the time of writing this post, there has never been a native feature within WooCommerce that allows you to reset the ordering of products within the “Products” section in the WordPress back-end.

Sure, you can go in and click the “Sort Products” link just above the table of products, then drag and drop products around until your heart is content. But what if you’d done this to 100s of products and simply needed to do a mass reset of their ordering?

Well, you can’t do it within WordPress! And there doesn’t appear to be any future plans of adding a native feature within WooCommerce – there isn’t enough of a demand for it.

The Solution

There is hope! If you know your way around phpMyAdmin or SQL databases, it’s easy enough to reset the ordering of products by running the following query within the database:

update wp_posts set menu_order=0 where post_type='product'

Once you’ve run that, all the products in the back-end and in the front-end “Shop” should reset to whatever you’ve got set as the “Default Product Sorting” option within the “WooCommerce > Settings > Products tab > Display tab” section.

Further discussions & future plans

There’s actually been some talk about the possibility of revising the product ordering and sorting system, but it’s highly unlikely this will happen. Then there’s another discussion over on GitHub that Mike Jolley started in addition to the previous conversation.

I tend to agree with what Mike has stated throughout the thread as it makes a lot of sense. Such as, the idea of completely removing the WooCommerce product ordering and sorting options as they’re clunky and confusing for some users. And with the direction WooCommerce is heading nowadays with their selection of premium plugins, it wouldn’t surprise us to see them release one that covers all of this.

Share your thoughts

So is this product sorting and ordering feature something you’d like to see included as a native WooCommerce feature? Or do you think it makes sense to strip it out, and have the feature developed as an extension? Let us know what you think in the comments.

6 Responses

  1. Hi Geoff, I’ve just taken over maintenance of a site that has products all over the place. I find it crazy that there isn’t a sort order reset. Thank you for writing this post. ๐Ÿ™‚

    1. I know right! It is pretty crazy, Jason! I’m surprised that WooCommerce haven’t added some kind of functionality to reset the ordering of products, as I thought it’d be something that a lot of people would need! Anyway, you’re welcome for this post, I’m glad you found it useful ๐Ÿ™‚

  2. Hi,
    I changed theme, deactivated all plugins, but the order by price still doesn’t work correctly.
    So perhaps your solution is what I need too.
    But could you please tell me how and where in PHP My admin I need to do this?

    1. Good effort for troubleshooting what you did! Here’s some steps that hopefully help ๐Ÿ™‚

      1. Once you’re logged in to your phpMyAdmin, via the left sidebar, click into the appropriate database for your website.
      2. Then in the window pane to the right, you should see an “SQL” tab, so click on that.
      3. Then copy and paste the query into the blank field, and make sure the prefix to the database table matches the prefix used within your database, e.g. “wp_posts” might be something like “abc_posts”.
      4. Then click the “Go” button and that should do the trick.

      Remember: always take a backup of your database before doing anything like this. Good luck!

Leave a Reply

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