I need to exclude Out of Stock items from displaying when the Woocommerce Recent Products shortcode is used on my front page.
[recent_products]
Is it possible to create a rule like hide_outofstock="true"
or something along those lines to stop Out of Stock products showing?
I have trawled the web looking for ideas on how to approach this problem, and I'm no coder at all but usually I'm able to frankenstein something to get around issues like this. However, right now I am stumped. All and any help will be much appreciated.
I can't just hide all out of stock products via the WooCommerce settings page as they need to be visible in other areas of the site.
Using a code that "hides" rather than "doesn't pull" out of stock products just shows empty spaces where the products would have been shown.
Needs to work dynamically as stock levels change often - manually restricting by product id will take too long.