WooCommerce Shortcodes (Checkout, Cart, Product & more)

WooCommerce comes with several pre-built features, one of which is WooCommerce shortcodes. 

These will help you display the products, cart, checkout, and more anywhere in your store. The name itself explains that it’s a short piece of code you can use anywhere on your site to perform a particular task or display specific information. 

The best thing about WooCommerce is it is open-source and very flexible. Several plugins in the market come with additional shortcodes, like the WooCommerce Product Table plugin. 

It allows you to use a shortcode that will display the product table. 

Similarly, several other plugins allow you to use custom shortcodes to perform a particular task. 

In today’s article, I’ll explore the default WooCommerce shortcodes that come with the WooCommerce installation and a few examples of custom shortcodes that come with third-party plugins. 

On This Page

What are WooCommerce Shortcodes?

As mentioned above, shortcodes are specific and short pieces of code used to perform a certain task or action. 

The text is wrapped within square braces and can be used anywhere on the WordPress site. There is a huge amount of code behind every shortcode, and it allows you to perform different actions. 

For example, The WooCommerce Product Tables plugin gives you the shortcode [product_table id=””] to display the product table anywhere on your site. 

Similarly, the AIO Checkout plugin gives you the shortcode [wooaio_checkout id=] to display the checkout anywhere on your site. It is helpful while creating order forms

Now that you have the basics of the shortcode, let’s dive into the list of WooCommerce shortcodes. 

List of WooCommerce Shortcodes

WooCommerce shortcodes are mainly divided into two types. 

  1. WooCommerce Page Shortcodes.
  2. WooCommerce Product Shortcodes.

Product shortcodes also include dynamic shortcodes, which you can customize according to your choice. We’ll discuss this later in this article. 

1. WooCommerce Page Shortcodes

Some necessary pages are automatically created when you install and activate the WooCommerce plugin. These pages are 

One thing to mention here is there is no shortcode for the default WooCommerce shop, privacy, and refund policy pages. You can delete these pages and create new ones. 

To select the custom shop page, you need to navigate to WooCommerce » Settings » Products from your WordPress dashboard and select the page you want to set as the shop page of your store. 

Don’t forget to save the settings. 

WooCommerce cannot function without the cart, checkout, and my account page. These are very important pages. Let’s dive in to explore each shortcode. 

1.1. Cart 

The cart page is where users can see all the products they have added to their basket. From there, they can increase and decrease the product quantity and delete a product from their basket. 

WooCommerce creates a default cart page. The cart page only has its shortcode at the backend, but when users interact with the page from the front, they can see their cart with a few other bits and pieces. 

Following is the shortcode that allows you to create a WooCommerce cart page

Your cart is currently empty.

Return to shop

This shortcode will allow you to display the user’s cart anywhere on your site. Also, if you had deleted the default cart page, you can simply create a new page, paste this shortcode and publish the page. 

This will create a well-designed default WooCommerce cart page. 

1.2. Checkout

The next step is the checkout page. It is the page where users will pay for their order and complete the purchase. 

Following is the checkout shortcode. 

You can use this shortcode on your site to create a checkout form. You can also use this shortcode to create a checkout page in case you have deleted the default page. 

Pro Tip: Checkout is one of the essential pages in online shopping, and it is necessary to optimize it. AIO Checkout is the plugin you need to customize and edit the checkout page to create a more optimized and conversion-focused checkout. 

1.3. My Account

It is also an essential page for WooCommerce to function correctly. It is a page where users can see their orders, account details, and more information. 

Following is the shortcode for my account page.


You can also use the arguments with this shortcode to make the shortcode more specific. 

1.4. Order Tracking Form

It is the page where users can enter their order id and the billing email to track it. The following shortcode will display the order tracking form in the front. 

To track your order please enter your Order ID in the box below and press the "Track" button. This was given to you on your receipt and in the confirmation email you should have received.

2. WooCommerce Product Shortcodes

These are the shortcodes used for the products and the categories. These will use arguments or args to make the shortcode more specific. So there can be several shortcodes. 

Here, I’ll discuss a few important ones you can customize according to your choice and use them.

Note: After discussing the shortcode list, I’ll mention how to use them. 

2.1. Products

This is one of the most powerful and dynamic shortcodes. It allows displaying your products on your store anywhere on the site. 

It uses different arguments or args, which may vary depending on your choice. Following is the basic shortcode to display all the products

It becomes complex when you use multiple arguments with it. It can display the products by ID, SKU, random sorting, product tags, and more. 

In the previous WooCommerce versions, if you wanted to display products by SKU, there was a different shortcode, and the same goes for other actions. Every action(to display the product based on various attributes) had a different shortcode. 

Following are a few examples.

A few other shortcodes are depreciated in the recent version of WooCommerce and replaced by the dynamic product shortcode. 

Moreover, you can use a few parameters with the product shortcode to customize the layout. The following are a few parameters you can use with it. 

1. Limit

It will allow you to limit the number of products to display. Its default value is set to -1, showing all the products in your store. You can easily set it to a custom limit with the help of the following example:

The above shortcode will display any three products from your store. 

2. Category

This parameter will allow you to display the products from a specific category. You can also use it in conjunction with other parameters. The following example will give you a clear idea. 

The above shortcode will display 4 products from the accessories category. 

3. Columns

It is a very helpful and important parameter. It will help you to change the number of product columns. By default, there will be 4 columns, meaning the products will be displayed in 4 columns. 

Remember, depending on your theme, the number of columns will decrease on smaller screen sizes. 

The following shortcode will display the 4 products from the accessories category in 2 columns. 

4. Orderby

This parameter allows you to select the order in which the products will be displayed. By default, it will order the products by title, but you can customize it using different values. 

It accepts different values. Following is the list of values it takes. 

  • date: It will display the products based on their published date. New products will be displayed first. 
  • id: It will order the products by their ID. 
  • menu_order: It will order products by the menu order (lower numbers first).
  • popularity: It will order the products by their popularity. The popularity is determined by the number of purchases(most first).
  • rand: It will display the products in random order. There might be issues with sites that use caching plugins.
  • rating: This option will order the products by their average rating, from higher to lower.

If you want to add more than one option, you can separate the options with a single space. The following example will give you a clear understanding. 

5. Tag

This option will allow you to display the products by tags. You’ll need to use a comma between the tags if you want to show products based on more than one tag. 

For example: 

6. Order

If you want to change the order of products to ascending or descending based on the option set in the orderby method, this option will help you. Its default value is ascending. 

For example:

If you want to change the order to descending, you can use the following code. Remember, as shown in the above examples, you can always use multiple parameters. 

7. On_sale

This parameter will help you if you want to display the products that are on sale. It accepts true or false. 

For example: