WooCommerce - excelling eCommerce
[resolved] List "out of stock" products on seperate page (8 posts)

  1. magicsun
    Posted 3 years ago #


    I wonder if it's possible to list out of stock products automatically as a seperate category or page ?

    Reason for this is that I want to have an "inspiration" page of all the sold jewelry, so that visitors can still see the sold products.

    Perfect would be to hide the out of stock in the catalog, but only make it visible on the category / page. This is not a must, I don't mind to have them twice inside the shop.

    Right now I've added all the out of stock products to a second category "sold", but this has to happen manually. Then I can list the category "sold" in the menu, and voila.

    Anyone know a code to make this happen?

    Thanks !


  2. Mike Jolley
    Plugin Author

    Posted 3 years ago #

    Use a custom query - meta_query will do it

    'key' 		=> '_stock_status',
    				'value' 	=> 'outofstock',
    				'compare' 	=> '='


  3. magicsun
    Posted 3 years ago #

    Sorry for the late reply, holiday season.

    I implemented it, but just a suggestion for future replies, would be great to have an example added into your post. Not everyone (myself included) knows how to implement all this stuff ... I ended up adding it in a different (probably older) way into my existing coding. Any suggestions to update this, are more than welcome.

    This is how I did it. The line below is in my loop:

    <?php query_posts( 'showposts=60&post_type=post' ); ?>

    Changed it to this:
    <?php query_posts( 'showposts=150&post_type=product&meta_key=_stock_status&meta_value=outofstock' ); ?>

    Then I made a page, and linked the new template to this page.

    Even when I say to hide out of stock products, they show on my "inspiration' page, but not in the webshop. Great stuff :)

    Many thanks !


  4. outlet2013
    Posted 2 years ago #

    hi, im interested in this mod!

    i need to create a new page with all my sold out item!

    mai i have complete procedure to mod woocommerce and create it?

    best regards

  5. outlet2013
    Posted 2 years ago #

    in fact i dont understand where to add your php code and implement page...

  6. timkwong
    Posted 2 years ago #

    I'm having a bit of trouble with this too.....could someone elaborate on the solution?

  7. riyota
    Posted 2 years ago #

    I haven't tried yet, though probably you first create a template page,
    then you change the loop on that page to something like the above.
    There should though be a way which mikejolley sugests to make changes in the functions.php file, Though even in that case you need to make a template for that category at least in my theme.

    Now I don't know if this helps... Depends how well versed you are in WP.

  8. beadseller
    Posted 2 years ago #

    I want to do the same thing that magicsun was asking. I have a separate category for Sold Items. Once an item sells, I change it to the sold category. I just don't want that category to show in the catalog. Is there a way to do that?
    Here is my site:

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic