• Resolved magicsun

    (@magicsun)


    Hi,

    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 !

    https://www.ads-software.com/extend/plugins/woocommerce/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Use a custom query – meta_query will do it

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

    https://codex.www.ads-software.com/Class_Reference/WP_Query#Custom_Field_Parameters

    Thread Starter magicsun

    (@magicsun)

    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 !

    xx

    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

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

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

    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.

    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:
    https://www.gentlespiritcreations.com/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: WooCommerce – excelling eCommerce] List "out of stock" products on seperate page’ is closed to new replies.