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.
Featured Products Shortcode
Display WooCommerce Featured Products via shortcode like so:
[featured_products per_page="9" columns="3"]
Other parameters you can use in the shortcode are ‘orderby‘ and ‘order‘.
Featured Products Custom Loop
Display WooCommerce Featured Products via a custom loop like so:
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.
Featured Products Shortcode Custom Loop
Display WooCommerce Featured Products via a shortcode custom loop like so:
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, only 3 products will show. Shortcode is:
[woo_featured]
Also commented out is …
// wc_get_template_part( 'content', 'product' );
You could use this instead of the custom output to render the default WooCommerce output.