A Complete Guide for WooCommerce Shortcodes

WooCommerce Shortcodes

Last updated - November 22, 2019

Shortcodes are small code snippets that will help you to achieve a functionality or display content based on certain conditions on your WooCommerce store. Basically, the primary advantage of shortcodes is that you can avoid typing a long stretch of code to achieve a certain functionality. That makes it popular among users of all knowledge levels. WooCommerce offers several shortcodes that will help you manage your posts and pages more effectively. In this article, we will provide an extensive view on WooCommerce shortcodes. This article will be the only one that you need to refer for anything related to WooCommerce shortcodes.

The basics of shortcodes

In WordPress terms, shortcodes are considered as macros that help you have dynamic interactions with content. Shortcodes help users of WordPress to alter their content according to specific requirements even without extensive coding knowledge. In fact, it helps you keep the content clean and semantic. Here are some of the advantages of using shortcodes in WordPress posts and pages:

  • Shortcodes do not add markup to the post content, and this means you have more freedom to alter the style of the page later.
  • They offer the flexibility to work differently, based on the parameters set by the user. This helps users to employ the same short code in different circumstances.

Benefits of WooCommerce shortcodes

WooCommerce shortcodes offer great control to store owners to dynamically display products, or add to cart buttons anywhere on the site. This is especially important because there might be several strategies that you want to experiment with on your store. Sometimes, you may have to place an add to cart button on a popular post, for the featured product. Rather than getting customers through the conventional sales channel, you will be able to experiment with different strategies to drive conversions.

WooCommerce shortcodes for pages

When you first installed WooCommerce, you might have noticed the onboarding wizard created a few pages such as cart, checkout, etc. If you open these pages, you can see there shortcodes automatically added to these pages. In fact, these shortcodes provide the functionality to these pages. If you don’t use the onboarding wizard, but later want to create these pages, you can simply add the respective shortcode to the page.

Now we will discuss some of the popular WooCommerce shortcodes that you can use on page on your online store at different scenarios.

Your cart is currently empty.

Return to shop

This shortcode makes your cart page functional. Basically, the cart page should be able to dynamically display the content that your customers add to their cart. It also acts as an interface for coupon codes and certain other elements of the cart page. This is a simple shortcode, which doesn’t have any option to add any conditions or parameters.

Checkout process is another essential aspect of a WooCommerce store. Your customers should be able to checkout smoothly from your site when they make a purchase on your store. This specific shortcode imparts its functionality to your checkout page. Just like the cart shortcode, this one too works simply, and does not offer an option to use selectively using different arguments.

Login

Register

A password will be sent to your email address.

My Account page is where your customers will be able to view their order details, modify shipping and billing addresses, etc. They will be also able to update their information on this page, such as name, email address, password, etc. This shortcode includes an argument, which helps to display the information of the current logged in user.

Your customers will be able to view details regarding their recent orders on this page.

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.

This shortcode offers an option to provide order tracking information to your customers. You can use it on an individual page, or combine with another shortcode to display the tracking form.

For example, you can add this shortcode on the My Account page, so that the tracking form is also available to customers.

With the WooCommerce shortcode for order tracking, your customers will be able to enter their order id to understand the status of their orders.

Displaying products using shortcodes

WooCommerce store owners require to display at different locations on their site under different circumstances. In the earlier versions of WooCommerce, there were different shortcodes for different product grouping.

If you wanted to display all your featured products on a page, you had to use this shortcode –

. Or, if you wanted to display products on sale, you had to use 
.

Now, for all sort of product displays, you can use the shortcode 

, instead of using several different shortcodes. All you have to do is specify your required conditions for the display. Accordingly, WooCommerce will display your selected set of products on the page or post that you add the shortcode.

For example, to display featured products, now you can use the shortcode like this – 

.

Or, to display products on sale, you can use this shortcode –