While WordPress has the block editor and various blocks for displaying WooCommerce products, shortcodes are still a popular method for displaying lists of WC products because unlike blocks they use consistent styling provided by the theme, instead of hard-coded styles that WC blocks use.
Here is a reference of the most common shortcodes for displaying WooCommerce products:
Products
Recent products
[products columns="4" limit="16" orderby="date" order="DESC" /]
On-sale products
[products columns="4" limit="16" on_sale="true" /]
Best-selling products
[products columns="4" limit="16" best_selling="true" /]
Featured products
[products columns="4" limit="16" visibility="featured" /]
Products by attribute
[products columns="4" limit="16" attribute="color" filter="black" /]
Products by categories
[products columns="4" limit="16" category="hoodies, tshirts" cat_operator="AND|IN|NOT IN" /]
Products by tags
[products columns="4" limit="16" tag="tag1, tag2" tag_operator="AND|IN|NOT IN" /]
Products by IDs
[products columns="4" ids="123, 456, 789, 101112"]
Products by SKUs
[products columns="4" skus="sku-1, sku-2, sku-3, sku-4"]
Additional options for [products]
shortcode
Ordering attributes
[products orderby="date|id|menu_order|popularity|rand|rating|title" order="ASC|DESC" /]
Add pagination
[products paginate="true" /]
Product categories
Top level product categories
[product_categories parent="0" /]
Products from a category
[product_category category="123" /]
Single product
Display a single product by ID
[product id="123"]
Display a single product by SKU
[product sku="product-sku"]
Product page
[product_page id="123"]
Leave a Reply