We have a POS system running on woocommerce which we use for instore purchases. This means we have a category for items that we do not sell online. I have a plugin which succesfully hides these categories and associated products from the front end but this does not affect the items display when we use the [recent_products] shortcode for some reason.
I’ve attempted to butcher the shortcode to hide this specific category but the items still show:
[recent_products per_page="4" order="desc" cat_operator="NOT IN" category="instore"]
Is this even possible using the recent product’s shortcode? Am I maybe missing something or is there another way I can display new products and exclude the category ‘instore’ – instore is the category slug, by the way, the full category name is Instore only
This has been troubling me for a while now.
Any suggestions will be most welcome.
Best Regards
Donna
2
Answers
It’s not possible with the
recent_products
shortcode alone… would need hook into thewoocommerce_shortcode_products_query
filter with some PHP code. Though I think you can achieve what you want with theproducts
shortcode like this:More examples here: https://woocommerce.com/document/woocommerce-shortcodes/#scenario-4-newest-products
Now that you want to hide it from shortcodes, why dont we give this quy a try:
just add this to your theme’s
functions.php
right before the ending?>
or if thefunctions.php
doesnt have?>
just add it after the last line and lets see if it does what it should do.