Home > WooCommerce > Docs > WooCommerce Shortcodes: Everything You Need to Know!

WooCommerce Shortcodes: Everything You Need to Know!

Last updated: May 01, 2024
This article has been written and researched by our expert Avada through a precise methodology. Learn more about our methodology





Shortcodes for WooCommerce allow you to show data from your store in new and creative ways. WooCommerce comes with a number of shortcodes pre-installed, and you may add more by installing plugins. You’ve come to the perfect place if you want to put products on a table, show the cart anywhere on your site, or do anything else.

In this article, I will show you Everything you need to know about WooCommerce Shortcodes.

Benefits of WooCommerce Shortcodes

WooCommerce shortcodes provide shop owners a lot of flexibility in dynamically displaying goods or adding to cart buttons on their websites. This is especially essential because you may want to try out a few different techniques inside your shop.

As a result, rather than acquiring consumers through traditional sales channels, you will be able to test various conversion techniques. When you view these pages and posts, you’ll see that shortcodes have been automatically added to them. These shortcodes, in fact, give these sites their functionality. If you don’t want to utilize the onboarding wizard but still want to make these pages, you can just use the shortcode.

That is to say, below are some of the most important advantages of using WooCommerce shortcodes in posts and pages:

  • Efficiency improvement
  • WooCommerce shortcodes allow for selective custom markup
  • Shortcodes allow access to ‘unreachable’ content areas
  • Better and more unique layouts using WooCommerce shortcodes

Benefits of WooCommerce Shortcodes

How to use Shortcodes

In WordPress, shortcodes may be used on both pages and posts. If you’re using the block editor, you may put the shortcode inside the shortcode block. You may paste the shortcode on the page or post if you’re using the traditional editor.

“Args” will be mentioned in a few of the shortcodes below. This is a list of options for making the shortcode more precise. By adding id=”99” to the [add to cart] shortcode, for example, an add-to-cart button for the product with ID 99 will be created.

How to use Shortcodes

How does WooCommerce Shortcodes work?

Shortcodes are made up of a single word or a group of words joined by underscores, such as this:

[products] [woocommerce_order_tracking]

While some shortcodes may be used without any parameters, some need them.

Parameters, also known as arguments (or args in certain WooCommerce documentation), are extra lines that customize the shortcode’s behavior. Parameters are used by most, but not all, WooCommerce shortcodes.

If you add on sale=”true” to the [products s] shortcode, for example, the only goods displayed will be those that are currently on sale.

5 types of WooCommerce ShortCodes

1. Product shortcodes

In a conventional grid layout, the Product category shortcode lists products from a given category. The shortcode is as follows:

[product_category clothing” per_page=”12” columns=”4” orderby=”default” order=”asc” operator=”in”]

You can use the WooCommerce Product Table shortcode instead if you don’t like the grid style or want more flexibility over what information to display about each product. You may utilize the category shortcode option in the WooCommerce Product Table plugin to list products from particular categories only:

[product_table category=”clothing”]

You can specify which columns of information to display about each product, and allow buyers to select variations and quantities directly from the product table, unlike the built-in [product category] shortcode that comes with WooCommerce. This speeds up your shopping experience and increases your conversion rate.

Product shortcodes

1.1 Product Categories shortcodes

Instead of listing the products within each category, the Product categories shortcodes list them. Consider the following scenario:

[product_categories limit=”4” orderby=”name” order=”ASC”] displays any four of your WooCommerce categories in alphabetical order.

Product Categories shortcodes

1.2 Recent products

The WooCommerce Recent Products shortcode shows the products that have been added to your online store recently. For recent products, use this shortcode:

[recent_products per_page=”8” columns=”4” orderby=”date” order=”ASC”]

You can use the WooCommerce Product Table plugin instead if you want to show the real date the product was added to your online store or if you want greater control.

Simply sort the product table by date in ascending order, and use the product limit number to limit the amount of products that are displayed:

[product_table sort_by=”date” sort_order=”desc” product_limit=”5”]

Customers can readily tell which products were recently added to the store if you include a date column in the table.

Recent products

Using the WooCommerce Featured Products shortcode, you may list featured products separately from the rest of your store. It can be used to list featured products everywhere, such as in blog articles or other sites.

WooCommerce products with a blue star icon next to them on the All Products page are featured. The following is the shortcode for highlighting featured products:

[featured_products per_page=”6” columns=”3” orderby=”date” order=”DESC”].

This is what the final product should look like.

If you don’t like the image grid, you can use the WooCommerce Product Table plugin shortcode to list featured products instead:

[product_table term=”product_visibility:featured”]

This displays featured products in a table format, with the information columns you specified on the plugin options page.

Featured products

1.4 Sale products

You can use the Sale products shortcode to display products that are currently on sale. You may quickly display them with the following shortcode:

[sale_products per_page=”6” columns=”3” orderby=”date” order=”DESC”]

Sale products

1.5 Best Selling products

To display your all-time best-selling products in a grid, use the WooCommerce shortcode below:

[best_selling_products per_page=”6” columns=”3” orderby=”date” order=”ASC”]

If you have the WooCommerce Quick View Pro plugin installed on your WordPress site, the quick view buttons will appear on the front end.

If you prefer a table layout, you can use the WooCommerce Product Table shortcode to list bestsellers or popular products like this:

[product_table sort_by=”popularity” sort_order=”desc” product_limit=5]

Best Selling products

1.6 Top rated products

To highlight your top-rated products, use the Top Rated Products shortcode in conjunction with WooCommerce’s built-in reviews and rating functionality. Use the following shortcode:

[top_rated_products per_page=”6” columns=”3” orderby=”date” order=”ASC”]

The WooCommerce Product Table shortcode can also be used to create a table display of top-rated products:

[product_table columns=”image,name,reviews,price,buy” sort_by=”reviews” sort_order=”desc” product_limit=”5”]

Top rated products

The WooCommerce similar products shortcode can be used anywhere on your site to display related products. Add the shortcode [related products per page=”3”].

The layout of this related products shortcode is identical to that of the single product page:

This layout, as you can see, takes up a lot of room for each product. Customers must navigate to each product’s website to select quantities and add related items to their cart, which is a poor user experience. If you’re concerned about this, you should instead use the similar products table shortcode.

The WooCommerce Product Table plugin allows you to list related products in a more user-friendly way. A shortcode can be used to show related products anywhere on your website. They’re listed in an order form format, with quantity pickers, dropdowns for variations, and add-to-cart buttons. Customers can now select options and add relevant products to their shopping without having to leave the current page.

Related products shortcodes

3. Add to cart button

The price and add to cart button for a single product can be shown using a WooCommerce shortcode depending on its ID [product id=”60”]

On the front end, it looks like this:

You might put this in a widgetized section of your online store or a blog article.

You can use WooCommerce Product Table instead of the usual format with the huge image if you’d want to display add-to-cart buttons for several products or if you don’t like the default format with the huge picture.

Choose the columns to include in the product table and place it wherever you want with the [product table] shortcode. To choose which products to include, use the include option, for example: [product table include=”123,456”]

Add to cart button

4. Product page shortcodes

Let’s start with some of the most commonly used WooCommerce page shortcodes. These generate complete pages, such as the cart or the checkout, automatically.

4.1. Shopping cart

The WooCommerce shopping cart shortcode allows you to show the customer’s shopping cart on the front end of your WordPress website. It may be added to WordPress pages or posts, and it can also be displayed in widgetized sections (such as the sidebar).

On the front end, it will appear something like this:

When you install and activate WooCommerce on your website, it creates certain pages for you, including the Cart page, which is where this shortcode is used. The shortcode can be used to add the cart to other places on your site.

Shopping cart

4.2 Checkout page

To create a comprehensive checkout page on your e-commerce website, utilize the WooCommerce checkout shortcode - [woocommerce_checkout]. When you install WooCommerce, this page is also immediately created for you. You can also use the shortcode to place the checkout somewhere else on the page (for example, under a product table to create one-page shopping).

Billing information, order information, and the ability to ship to a different address are all included in the WooCommerce checkout shortcode.

Checkout page

4.3 Order tracking

The [woocommerce_order_tracking] shortcode in WooCommerce allows store owners to construct an order tracking page. Although this page does not come with WooCommerce out of the box, you can easily construct your own by creating a new page and pasting the shortcode into the text editor. On the front end, it should appear something like this:

Order tracking

4.4 User account page

When you initially install WooCommerce on your website, it produces a My Account page for you. The [woocommerce_my_account] shortcode is used to accomplish this. You can use the shortcode to place the account area in different places on your site.

For logged-out users, the My Account shortcode serves as a login and registration form. As a result, this shortcode can be used as a WooCommerce login shortcode.

User account page

5. Page shortcodes

You won’t have to manually add the shortcodes because WordPress comes with four basic pages that already have them. If that wasn’t the case, you may duplicate the pages using the shortcodes and then clarify them in the settings.

5.1 Cart

It’s used on the cart page to display the cart content once your clients have added items to their cart. It also shows the interface for coupon codes, cart bits and pieces, and other items seen on a typical cart page. Because this is a simple shortcode, you don’t need to add any other conditions or arguments.

5.2 Checkout

When your consumers have finished collecting all of the products/services they desire, they will click check-out, which is when the checkout shortcode will be used. It will show all of the relevant information to the shopper prior to checkout, such as payment method, billing information, shipping information, and so on. This is also a straightforward shortcode that doesn’t require any further parameters.

5.3 Private account

Customers should be able to see and change their personal information, such as their name, email address, and password, as well as their order information, such as shipping and billing addresses. Users will be able to see, modify, and update those details using this shortcode. It also has an argument for displaying information about the current shopper.

5.4. Order form

Unlike the previous three page shortcodes, this one isn’t generated automatically by default, but you may use it to let your customers know how their orders are progressing. Shoppers must enter their order data in the Order Tracking Form if they want to check the progress of an order.

Shortcodes common issue

WordPress version 4.2.3 was published at the end of July, and it included a significant security patch that directly impacts the Shortcode API. Unfortunately, many WordPress plugins’ shortcodes ceased working after the upgrade, or had problems of some sort. Many users discovered that the shortcode’s content was not being assessed, thus instead of seeing the content that the shortcode creates, they would see the plain shortcode text on their site.

One of the major difficulties here is that many users are unfamiliar with WordPress or just have automatic updates turned on and don’t pay attention to security upgrades because they are, for the most part, fully compatible with existing plugins and themes. As a result, when something like a shortcode starts behaving up, users may not notice an update has been issued and believe they are to blame.


WooCommerce shortcodes are small code snippets that allow you to customize your online store. They can be added to your website’s shop pages, blogs, or widgetized places (such as the sidebar). You can utilize parameters with several WooCommerce shortcodes to alter the result.

Not all WooCommerce shortcodes, however, provide a positive user experience. You could use them in conjunction with the WooCommerce Product Table plugin or the WooCommerce Quick View Pro plugin instead of pasting them as-is.

I hope that you find this topic about WooCommerce Shortcodes: Everything You Need to Know useful!

Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Singapore. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.

Stay in the know

Get special offers on the latest news from AVADA.