• I have had several reasons in the past and currently why I would want a specific product(s) to be displayed even though it is out of stock. Right now, as far as I know, the only way to keep a product displayed when out of stock is to set the global option for this. However, this option then displays ALL items that are out of stock. This setting would then display hundreds if not thousands of items that we no longer sell. So setting this global option box is not a viable solution.
    It seems to me that this would be a desirable FEATURE that could be set on a per product basis. Does anyone have a workaround that could give me what I need? Hopefully, the woocommerce developers would consider this feature in a future release.
    Thank-you
    John

Viewing 12 replies - 1 through 12 (of 12 total)
  • D Smith a11n

    (@dsmithweb)

    Automattic Happiness Engineer

    hey John!

    This sounds like a good feature to suggest at Woo Ideas.

    In the meantime, there are workarounds depending how and where you want to display those products. For instance, you could create a new category, “Show When Out of Stock,” add certain items to it, use this code, add a category filter to it, then run it on whatever page you wanted those to show up.

    Mina

    (@purpleberryservices)

    Hi,

    You would like to just display the product or want user to be able to place order for Out of Stock items as well?

    Mina

    (@purpleberryservices)

    Thread Starter trader4300

    (@trader4300)

    No, I just want to display certain products, even though they are out of inventory. Dont necessarily want to sell any more of these, but being able to display certain items within the same category allows people who bought these items to enter a REVIEW, see important information about it, etc…

    Thread Starter trader4300

    (@trader4300)

    Thanks Mina. Questions: Which file does this snippet go into? Also, if I want multiple products to be displayed, do I just seperate the product ID’s with commas? Can you give an example?
    And thank-you so much for generating this.
    John

    Mina

    (@purpleberryservices)

    Here is a code snippet to do that: https://gist.github.com/MinaPansuriya/6599c704c939850f4a136bd13de1f75a

    Hope this will be helpful.

    Mina

    (@purpleberryservices)

    It will goes to your child theme’s functions.php file

    If you want to have multiple product use if statement like this.
    if( ($productId == 6838) || ($productId == 6838) )

    Thread Starter trader4300

    (@trader4300)

    Mina,
    I copied your code snippet and put it into my functions.php file. I replaced the product ID with one of mine that is currently out of stock. I then saved the file. Went to my website and selected the category where the product is suppose to show up. Not there. Refreshed page several times. Even tried on Incogneto browser. Just not working.
    Website is https://www.goodolddayscountryshop.com. The product ID I entered was 25156 which is for the “Paint a Bowl” workshop. It should show up under WORKSHOPS category. Any thoughts?

    Mina

    (@purpleberryservices)

    Important Note: You have to uncheck “Hide out of stock items from the catalog” option on WooCommerce->Settings->Product->Inventory Tab from WordPress Admin Panel

    Thread Starter trader4300

    (@trader4300)

    Excellent, by unchecking this, all the items I entered into the loop now appear on my products page. Thank-you for this bit of genius. But, I need to ask… That option that I unchecked – It seems to me that this would now SHOW all out of stock items. Why doesn’t it do that? If it did that, I wouldn’t need your snippet right? So what am I missing here?

    Mina

    (@purpleberryservices)

    I am glad your issue is resolved. Have a good time.

    • This reply was modified 8 years, 1 month ago by Mina.
    Mina

    (@purpleberryservices)

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Display Product when inventory is zero’ is closed to new replies.