How to Displaying Featured Products in WooCommerce

WooCommerce has products called Featured Products which are products what become featured when they are starred in the WP Admin dashboard.

Here is how you can display them.

Display WooCommerce Featured Products via shortcode like so:

[featured_products per_page="9" columns="3"]

Featured Products Custom Loop

Display WooCommerce Featured Products via a custom loop like so:View the code on Gist.

Above I am creating a loop with an infinite amount of featured products by setting the value ‘-1’ to the ‘post_per_page’ key, in the loop markup output  I am using some regular WooCommerce css classes to the display of the data and my own data structure of the parts of the product I want to display.

See also  How to Add Defer and Async to WordPress Enqueued Scripts

Featured Products Shortcode Custom Loop

Display WooCommerce Featured Products via a shortcode custom loop like so:View the code on Gist.

The above is pretty much the same as the previous loop – this time shortcode is created which needs to be added to an area to display it [[woo_featured]] and only 3 products will show.

Leave a Reply

Your email address will not be published. Required fields are marked *