WooCommerce comes with various shortcodes that can be used to put content inside posts and pages. All shortcodes work correctly only when they are properly inserted. Please carefully insert WooCommerce shortcodes.
WooCommerce Shortcodes for Page
Below the following shortcode for WooCommerce pages:
a) Cart Page: Woocommerce cart shortcode displays cart content and coupon codes and other cart objects.
b) Checkout Page: Woocommerce checkout shortcode displays the checkout process.
c) Order Tracking: Woocommerce order tracking shortcode allow user see the status of an order by entering their order details.
d) User Account: Woocommerce my account shortcode shows the ‘my account’ section where the customer can view previous orders and update their detail.
Woocommerce products shortcode
The Woocommerce products shortcode is one of our most important shortcodes. The [products] shortcode allow you to display products by post ID, SKU, categories, attributes, and more. See below some shortcodes examples:
[recent_products per_page="12" columns="4"]
It is show the lists of most recent products added to your WooCommerce site. It is very useful on the homepage for show recent products. The ‘per_page’ shortcode determines how many products to show on the page. The columns attribute controls how many columns show on page for products.
[featured_products per_page="12" columns="4"]
It works the same as recent products but displays products that have been set as “featured”. In this above example, the shortcode is saying: Show 12 featured products in 4 columns in a row.
Product: Show a single product by ID or SKU.
Products: Show multiple products by ID or SKU.
[products ids="1, 2, 3, 4, 5"]
[products skus="port23, york21, bag22" orderby="date" order="desc"]
Product Category shortcodes
These two woocommerce category shortcode will display your product categories on any page.
[product_category] – Display a specified product category.
[product_categories] – Display all your product categories.
Product Category: Use the below code to show multiple products in a category by slug.
Product search functionality
It creates a simple search facility anywhere on a page. It shows you instant search results that match searching criteria. It is very useful to help your users while they are trying to search any product in your website.
There are many more shortcodes which we will be discussing later. You may also want to read our complete article on how to fix woocommerce thumbnail gallery error after updating woocommerce plugin.