Please consider leaving a donation if you appreciate this information. Lightning network now available
Perhaps you would like to showcase items on sale in a given product category – how can this be done? It’s quite trivial to use the WooCommerce provided Product category shortcode to display only products in that particular category. Likewise, it is just as easy to implement the WooCommerce provided Sale Products shortcode. But how is it possible to combine the two? It’s actually quite easy to do with a small code snippet. WooCommerce provides a filter called woocommerce_shortcode_products_query – which can be used to modify any of the shortcode product queries. Here is an example of how to use it when the product category shortcode is used, but you only want to output sale items:
Not sure what to do with code snippets? See What Do I Do With These Code Snippets?
Please consider leaving a donation if you appreciate this information. Lightning network now available
Leave a Reply
You must be registered and logged in to post a comment.