1. Cart page
This shortcode displays the shopping cart page on the chosen space within your WooCommerce store. It shows the customer’s shopping cart content and provides options to update items, apply coupon codes, and proceed to checkout.WooCommerce cart page displayed using the shortcode
Most WooCommerce themes automatically include this shortcode on the shopping cart page, but you can use it to create a custom one. Since it doesn’t have customizable attributes, you only need to paste the code as is to use it.
2. Checkout page
WooCommerce checkout form displayed using the
3. User account page
Login
Register
For guests who aren’t logged in, this shortcode shows a sign-in form.
WooCommerce user account section displayed using the
Login
Register
4. Order tracking form
WooCommerce order tracking form displayed using the
Unlike the Order section in
Login
Register
5. Show a specific product page
Use this shortcode to feature a product by its ID or Stock Keeping Unit (SKU) code anywhere on your page or post. It displays the product’s information, including the title, price, description, reviews, and an add-to-cart button.
WooCommerce product page displayed using the shortcode
Here’s an example of the product page shortcode with both attributes:
6. Product listings
While showcases a full product page, the
WooCommerce product listings displayed using the shortcode
Product attributes
Here are the key attributes for customizing the output of the WooCommerce
id
This attribute displays a specific item by its product ID.
Example: skus
This attribute shows a specific product based on their SKU. Avoid using it together with the ID attribute to prevent conflicting output.
Example: limit
Use this attribute to control how many products appear when featuring multiple products using a single shortcode.
Example:
This attribute sets the number of columns for displaying products, which is great for saving space. It defaults to four columns unless specified otherwise.
Example:
This attribute lets you specify the sorting order of the displayed products.
Here are the available options:
title (default) ‒ sort by the product title.
date ‒ sort by the product publication date.
popularity ‒ sort by the number of purchases.
rating ‒ sort by average product rating.
rand ‒ display products in random order.
id ‒ sort by product ID.
Example:
This attribute defines whether the product order is ascending (ASC) or descending (DESC). It defaults to ascending unless specified otherwise.
Example:
Use this attribute to display products from specific categories based on their slugs. Separate multiple category slugs with commas.
Example: tag
This attribute shows products with specific tags. Similar to the category attribute, use commas to separate multiple product tags.
Example: class
This attribute adds a custom CSS class to modify the output’s style. Before using it, you must create a custom CSS class in your theme’s stylesheet (style.css).
Example:
This attribute lets you show products that are on sale. When used, WooCommerce filters your products and shows only those with a sale price. Set it to true to enable this filter or false to show all products.
Avoid using on_sale with best_selling and top_rated attributes to prevent conflicting outputs, as combining them can create confusion over which criteria should be prioritized.
Example:
Use this attribute with a true value to showcase best-selling products only. Don’t use it together with the on_sale and top_rated attributes to avoid conflicting prioritization.
Example:
This attribute showcases top-rated products based on user ratings, accepting true and false as its options. Avoid using it together with the on_sale and best_selling attributes to prevent conflicting filters.
Example:
Set this attribute to true to enable pagination for the retrieved products. Combine it with the limit attribute to control the number of products displayed per page.
Example:
This attribute filters products by their visibility status, such as:
visible (default) ‒ products visible in the shop and search results.
catalog ‒ products visible in the shop only, not in search results.
search ‒ products visible in search results only, not in the shop.
hidden ‒ products hidden from both the shop and search results.
featured ‒ products marked as featured.
Example:
number ‒ set the number of categories displayed. It works similarly to the limit attribute in the
columns ‒ define the number of columns to display the retrieved categories.
include ‒ determine which categories to show by their IDs.
orderby ‒ specify the sorting order of the displayed product categories. Here are the available options:
name ‒ sort by product category name.
id ‒ sort by category ID.
slug ‒ sort by category slug.
menu_order ‒ sort by the menu order assigned in WooCommerce settings.
count ‒ sort by the number of products in each category.
order ‒ define whether the product category order is ascending (ASC) or descending (DESC).
hide_empty ‒ hide categories that don’t have any products.
parent ‒ display product categories that are children of a specific parent category.
Example: 8. Display a specific product category
Despite having a similar name to the
shortcode, focuses on displaying products from the specified category. It’s ideal for featuring relevant products on their respective category landing pages or highlighting trending items from a particular category.This shortcode requires the category attribute with your chosen product category’s slug to work. You can then pair it with the following attributes to customize the output:
columns ‒ set the number of columns to display products. The default value is 4.
orderby ‒ determine the sorting method. It has the same options as the orderby attribute in the shortcode.
order ‒ specify the sorting order.
per_page ‒ limit the number of products displayed per page.
paginate ‒ enables pagination when set to true.
Example: 9. Related products
Adding this shortcode to a product page prompts WooCommerce to show related products based on the categories and tags shared by the current product being viewed.
Since you can’t manually choose the related products, this shortcode is best used on individual product pages for cross-selling.
Pair this shortcode with the posts_per_page attribute to limit the number of related products displayed. You can also use the columns attribute to control the layout of the output.
Example:
10. Recently added products
11. Featured products This shortcode is ideal for highlighting featured products or promotions on your site. Like the
12. Best-selling products
Use limit, columns, and orderby attributes to customize your product display.
13. Top-rated products
Combine this shortcode with the limit, columns, and orderby attributes to customize the output.
14. Discounted products If you want to create a dedicated sales page or section to promote discounted products, this shortcode makes the job easier. Simply add the limit, columns, and orderby attributes to customize how the section appears.
15. Add-to-cart button and URL
The shortcode adds an add-to-cart button for a specific product on your chosen page or post. This way, customers can easily add items to their cart without visiting individual product pages, which is useful for promoting products on non-WooCommerce pages.
Use the id or sku attribute to link a product to the add-to-cart button. You can then customize the button’s appearance with additional attributes, such as:
style ‒ customize the button’s style with inline CSS, which applies only to that particular element.
show-price ‒ display the product price next to the add-to-cart button when set to true.
class ‒ add a reusable custom CSS class to modify the button’s appearance.
quantity ‒ specify the quantity added to the cart.
The following shortcode is an example of using these attributes to show the product price next to the button and center its placement:
If you prefer not to use a button for the add-to-cart function, consider using to create a link instead. This shortcode generates a direct URL that automatically adds a specific product to the cart when visited.
It’s convenient for encouraging sales in emails or areas of your WooCommerce site where button placement might be limited.
Since this shortcode creates a link, you only need to add the id or sku attribute for the chosen product.
Example:
16. Shop notifications on non-WooCommerce pages
When placed strategically, the shortcode can help reduce confusion at critical points in the customer journey and enhance the overall shopping experience. It’s also useful on custom pages where important notices need to be visible to customers.
This shortcode doesn’t have any attributes, so you just need to place it in the desired location. The messages are customizable, but doing so requires using a WordPress filter or overriding the theme files in the notices directory.
WooCommerce store notification displayed using the shortcode
17. Live product search field with filters
[woocommerce_product_search]
WooCommerce Product Search, a premium WooCommerce extension, offers this shortcode to display live product search filter functionality on pages and posts. As customers type keywords into the search field, matching results appear in real-time, enhancing the user experience.
By default, the [woocommerce_product_search] shortcode shows product titles with their short descriptions, prices, and add-to-cart buttons. To customize the display, refer to the extension’s documentation for available attributes.
WooCommerce product search field displayed using the [woocommerce_product_search] shortcode
You can expand the search functionality with various filters. Use these filters with the [woocommerce_product_filter_products] shortcode to display search results dynamically:[woocommerce_product_filter] — displays a live Product Search filter where visitors can input keywords to refine their results.[woocommerce_product_filter_attribute] — shows a live Product Attribute filter, ideal for stores selling variable products.[woocommerce_product_filter_category] — embeds a live Product Category filter to only output specified results by category.[woocommerce_product_filter_price] — displays a live price filter with an input field and slider to set a desired price range.[woocommerce_product_filter_tag] — adds a live Product Tag filter where visitors can refine results by chosen tags.[woocommerce_product_filter_rating] – embeds a live Product Rating filter to display products by average customer rating.[woocommerce_product_filter_sale] – shows a live filter for discounted products.[woocommerce_product_filter_stock] – features products that are in stock or available for backorder.[woocommerce_product_filter_reset] – adds a button to clear all live filters.