• Resolved craigmckee

    (@craigmckee)


    Morning all,

    I have set up WooCommerce to hide products that are out of stock. Works great! The problem is though, on my shop page where it lists the categories, it will show categories that have no products in (e.g. there are products in the store but they are all out of stock so it just leads to an empty page).

    How do I get round this? (Click on Essentials and you’ll see what I mean).

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Cara

    (@dcka)

    Hi, @craigmckee!

    I checked the Essentials category on your site, and I do see what you mean. I found a mini-plugin that could help though: Hide categories with no visible products in the Product Category Widget

    Can you see if that works for you?

    Thread Starter craigmckee

    (@craigmckee)

    Thank you @dcka, I tried to download it but it’s coming up with “Forbidden” so I’ve emailed to see if I can get a copy.

    Thank you.

    Plugin Support Cara

    (@dcka)

    You’re very welcome!

    And as an aside, you can also try downloading the ZIP file from the code’s GitHub page here:
    https://gist.github.com/cklosowski/df41c06eb21f0405a618606f2b0daacc#file-woocommerce-hide-empty-categores-php

    Thread Starter craigmckee

    (@craigmckee)

    @dcka Thank you. I was able to upload the plugin but it’s not working. Perhaps because I’m displaying everything through this shortcode rather than a widget?

    [product_categories columns=”3″]

    Plugin Support Cara

    (@dcka)

    I was able to upload the plugin but it’s not working. Perhaps because I’m displaying everything through this shortcode rather than a widget?

    [product_categories columns=”3″]

    @craigmckee, that would make sense!

    I ran some extra tests for you on my site, and I used the same [product_categories] shortcode. I then set up a category, category1, to contain one product that is out of stock.

    As you’ll see in this screenshot, category1 shows up in my sidebar, but it is hidden where in the display created by the [product_categories] shortcode:

    Link to image: https://d.pr/i/iuT7l8

    For reference, my site is using the latest versions of both WordPress (5.7.1) and WooCommerce (5.3). So, I’m wondering if that might be the difference between your site and mine.

    Can you please check what version of WooCommerce your site is using? You can check that under WooCommerce > Status > System Status or WP Admin > Plugins.

    Thread Starter craigmckee

    (@craigmckee)

    I’m using WooCommerce 5.3.0, WooCommerce – Exclude empty categories from widget 0.1 and WordPress 5.7.2

    But still showing that Essentials category even though when you click it, it’s empty.

    Plugin Support Cara

    (@dcka)

    Hmmm… that is very strange!

    Let’s see if it’s being caused by a conflict, either with your site’s theme or a plugin. If you’re up for that, can you please install this plugin: Health Check?

    That plugin has a troubleshooting mode where only you as the admin will see any changes made to the site. The general steps for the conflict test would be:

    1. Enable troubleshooting mode on the Health Check plugin. This will deactivate all plugins and switch the site’s theme to a default one like Storefront
    2. Activate WooCommerce
    3. Check if the Essentials category still shows up

    If the problem is gone, then activate plugins one at a time. In between each activation, repeat step 3. If you’re interested, we have a more in-depth guide on using that plugin here:
    https://docs.woocommerce.com/document/troubleshooting-using-health-check/

    Thread Starter craigmckee

    (@craigmckee)

    OK, I’ll give it a try.

    Plugin Support Dani F. a11n

    (@danielinhou)

    Hi @craigmckee ????

    OK, I’ll give it a try.

    Sounds good, keep us posted if you find anything. We’ll be glad to help!

    Cheers

    Plugin Support B C. a11n

    (@battouly)

    Hey @craigmckee,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved. If you have any further questions, you can start a new thread.

    Best!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Hide empty categories’ is closed to new replies.