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.
Your cart is currently empty.
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
Login
Register
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.
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.
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.
Paid Services – LearnWoo
$10
Add to cart
WooCommerce Google Analytics Pro Plugin
$79
Buy at WooCommerce.com
WooCommerce Product CSV Import Suite Plugin
$49
Buy at WooCommerce.com
WooCommerce Product Vendors Plugin
$79
Buy at WooCommerce.com
WooCommerce Checkout Field Editor Plugin
$49
Buy at WooCommerce.com
WooCommerce Customer / Order / Coupon Export Plugin
$79
Buy at WooCommerce.com
WooCommerce Follow-Ups Plugin
$99
Buy at WooCommerce.com
WooCommerce Product Add-Ons Plugin
$49
Buy at WooCommerce.com
Advanced Catalog Mode For WooCommerce
$79
Buy at WooCommerce.com
Shipping Calculator, Purchase Shipping Label & Tracking for Customers
$79
Buy at WooCommerce.com
WSDesk – Helpdesk & Customer Support Ticket System
$99
Buy at WooCommerce.com
Bulk Edit Products, Prices, and Attributes
$79
Buy at WooCommerce.com
WooCommerce Authorize.net Plugin
$79
Buy at ELEXtensions
WooCommerce Australia Post Shipping Method Plugin
$69
Buy at ELEXtensions
WooCommerce Product Bundles Plugin
$49
Buy at WooCommerce.com
WooCommerce AutomateWoo Plugin
$99
Buy at WooCommerce.com
WooCommerce Shipment Tracking Plugin
$49
Buy at WooCommerce.com
WooCommerce Table Rate Shipping Plugin
$99
Buy at WooCommerce.com
WooCommerce Smart Coupons Plugin
$99
Buy at WooCommerce.com
WooCommerce Composite Products Plugin
$99
Buy at WooCommerce.com
WooCommerce Deposits Plugin
$179
Buy at WooCommerce.com
WooCommerce Bookings Plugin
$249
Buy at WooCommerce.com
WooCommerce Memberships Plugin
$199
Buy at WooCommerce.com
WooCommerce Pre-Orders Plugin
$129
Buy at WooCommerce.com
WooCommerce Product Designer Plugin
$299
Buy at WooCommerce.com
WooCommerce Subscriptions Plugin
$199
Buy at WooCommerce.com
Email Customizer for WooCommerce Subscriptions
$79
Buy at WooCommerce.com
Dynamic Pricing & Discounts – YayPricing
$49
Buy at WooCommerce.com
Multi-Currency Switcher
$49
Buy at WooCommerce.com
For example, to display featured products, now you can use the shortcode like this –
.
Paid Services – LearnWoo
$10
Add to cart
WooCommerce Google Analytics Pro Plugin
$79
Buy at WooCommerce.com
WooCommerce Product CSV Import Suite Plugin
$49
Buy at WooCommerce.com
WooCommerce Product Vendors Plugin
$79
Buy at WooCommerce.com
WooCommerce Checkout Field Editor Plugin
$49
Buy at WooCommerce.com
WooCommerce Customer / Order / Coupon Export Plugin
$79
Buy at WooCommerce.com
WooCommerce Follow-Ups Plugin
$99
Buy at WooCommerce.com
WooCommerce Product Add-Ons Plugin
$49
Buy at WooCommerce.com
Advanced Catalog Mode For WooCommerce
$79
Buy at WooCommerce.com
Shipping Calculator, Purchase Shipping Label & Tracking for Customers
$79
Buy at WooCommerce.com
WSDesk – Helpdesk & Customer Support Ticket System
$99
Buy at WooCommerce.com
Bulk Edit Products, Prices, and Attributes
$79
Buy at WooCommerce.com
WooCommerce Authorize.net Plugin
$79
Buy at ELEXtensions
WooCommerce Australia Post Shipping Method Plugin
$69
Buy at ELEXtensions
WooCommerce Product Bundles Plugin
$49
Buy at WooCommerce.com
WooCommerce AutomateWoo Plugin
$99
Buy at WooCommerce.com
WooCommerce Shipment Tracking Plugin
$49
Buy at WooCommerce.com
WooCommerce Table Rate Shipping Plugin
$99
Buy at WooCommerce.com
WooCommerce Smart Coupons Plugin
$99
Buy at WooCommerce.com
WooCommerce Composite Products Plugin
$99
Buy at WooCommerce.com
WooCommerce Deposits Plugin
$179
Buy at WooCommerce.com
WooCommerce Bookings Plugin
$249
Buy at WooCommerce.com
WooCommerce Memberships Plugin
$199
Buy at WooCommerce.com
WooCommerce Pre-Orders Plugin
$129
Buy at WooCommerce.com
WooCommerce Product Designer Plugin
$299
Buy at WooCommerce.com
WooCommerce Subscriptions Plugin
$199
Buy at WooCommerce.com
Email Customizer for WooCommerce Subscriptions
$79
Buy at WooCommerce.com
Dynamic Pricing & Discounts – YayPricing
$49
Buy at WooCommerce.com
Multi-Currency Switcher
$49
Buy at WooCommerce.com
Or, to display products on sale, you can use this shortcode –
.
Paid Services – LearnWoo
$10
Add to cart
WooCommerce Google Analytics Pro Plugin
$79
Buy at WooCommerce.com
WooCommerce Product CSV Import Suite Plugin
$49
Buy at WooCommerce.com
WooCommerce Product Vendors Plugin
$79
Buy at WooCommerce.com
WooCommerce Checkout Field Editor Plugin
$49
Buy at WooCommerce.com
WooCommerce Customer / Order / Coupon Export Plugin
$79
Buy at WooCommerce.com
WooCommerce Follow-Ups Plugin
$99
Buy at WooCommerce.com
WooCommerce Product Add-Ons Plugin
$49
Buy at WooCommerce.com
Advanced Catalog Mode For WooCommerce
$79
Buy at WooCommerce.com
Shipping Calculator, Purchase Shipping Label & Tracking for Customers
$79
Buy at WooCommerce.com
WSDesk – Helpdesk & Customer Support Ticket System
$99
Buy at WooCommerce.com
Bulk Edit Products, Prices, and Attributes
$79
Buy at WooCommerce.com
WooCommerce Authorize.net Plugin
$79
Buy at ELEXtensions
WooCommerce Australia Post Shipping Method Plugin
$69
Buy at ELEXtensions
WooCommerce Product Bundles Plugin
$49
Buy at WooCommerce.com
WooCommerce AutomateWoo Plugin
$99
Buy at WooCommerce.com
WooCommerce Shipment Tracking Plugin
$49
Buy at WooCommerce.com
WooCommerce Table Rate Shipping Plugin
$99
Buy at WooCommerce.com
WooCommerce Smart Coupons Plugin
$99
Buy at WooCommerce.com
WooCommerce Composite Products Plugin
$99
Buy at WooCommerce.com
WooCommerce Deposits Plugin
$179
Buy at WooCommerce.com
WooCommerce Bookings Plugin
$249
Buy at WooCommerce.com
WooCommerce Memberships Plugin
$199
Buy at WooCommerce.com
WooCommerce Pre-Orders Plugin
$129
Buy at WooCommerce.com
WooCommerce Product Designer Plugin
$299
Buy at WooCommerce.com
WooCommerce Subscriptions Plugin
$199
Buy at WooCommerce.com
Email Customizer for WooCommerce Subscriptions
$79
Buy at WooCommerce.com
Dynamic Pricing & Discounts – YayPricing
$49
Buy at WooCommerce.com
Multi-Currency Switcher
$49
Buy at WooCommerce.com
Different attributes you can use with Products shortcode
Now, let’s us take a look at all the available attributes that will help you display products selectively on your WooCommerce store.
Set a limit to the number of products
Using the ‘limit’ attribute, you can specify how many products you want to display using the shortcode. The default option will display all the products, and so does limit=”-1″. To display all products, you can simply add the shortcode
as well.
Paid Services – LearnWoo
$10
Add to cart
WooCommerce Google Analytics Pro Plugin
$79
Buy at WooCommerce.com
WooCommerce Product CSV Import Suite Plugin
$49
Buy at WooCommerce.com
WooCommerce Product Vendors Plugin
$79
Buy at WooCommerce.com
WooCommerce Checkout Field Editor Plugin
$49
Buy at WooCommerce.com
WooCommerce Customer / Order / Coupon Export Plugin
$79
Buy at WooCommerce.com
WooCommerce Follow-Ups Plugin
$99
Buy at WooCommerce.com
WooCommerce Product Add-Ons Plugin
$49
Buy at WooCommerce.com
Advanced Catalog Mode For WooCommerce
$79
Buy at WooCommerce.com
Shipping Calculator, Purchase Shipping Label & Tracking for Customers
$79
Buy at WooCommerce.com
WSDesk – Helpdesk & Customer Support Ticket System
$99
Buy at WooCommerce.com
Bulk Edit Products, Prices, and Attributes
$79
Buy at WooCommerce.com
WooCommerce Authorize.net Plugin
$79
Buy at ELEXtensions
WooCommerce Australia Post Shipping Method Plugin
$69
Buy at ELEXtensions
WooCommerce Product Bundles Plugin
$49
Buy at WooCommerce.com
WooCommerce AutomateWoo Plugin
$99
Buy at WooCommerce.com
WooCommerce Shipment Tracking Plugin
$49
Buy at WooCommerce.com
WooCommerce Table Rate Shipping Plugin
$99
Buy at WooCommerce.com
WooCommerce Smart Coupons Plugin
$99
Buy at WooCommerce.com
WooCommerce Composite Products Plugin
$99
Buy at WooCommerce.com
WooCommerce Deposits Plugin
$179
Buy at WooCommerce.com
WooCommerce Bookings Plugin
$249
Buy at WooCommerce.com
WooCommerce Memberships Plugin
$199
Buy at WooCommerce.com
WooCommerce Pre-Orders Plugin
$129
Buy at WooCommerce.com
WooCommerce Product Designer Plugin
$299
Buy at WooCommerce.com
WooCommerce Subscriptions Plugin
$199
Buy at WooCommerce.com
Email Customizer for WooCommerce Subscriptions
$79
Buy at WooCommerce.com
Dynamic Pricing & Discounts – YayPricing
$49
Buy at WooCommerce.com
Multi-Currency Switcher
$49
Buy at WooCommerce.com
For example, you can limit the display of products like this:
. The result will be as the below screenshot:
Paid Services – LearnWoo
$10
Add to cart
WooCommerce Google Analytics Pro Plugin
$79
Buy at WooCommerce.com
WooCommerce Product CSV Import Suite Plugin
$49
Buy at WooCommerce.com
WooCommerce Product Vendors Plugin
$79
Buy at WooCommerce.com
WooCommerce Checkout Field Editor Plugin
$49
Buy at WooCommerce.com
WooCommerce Customer / Order / Coupon Export Plugin
$79
Buy at WooCommerce.com
Changing the layout of product display
There are a few attributes that will help you modify the layout of the products. These are:
- columns
- paginate
- orderby
Let’s see how to use each.
columns
If you want to specify the number of columns in the display, you can do that. In the above example, if we add the ‘columns’ attribute and specify the number 6, all 6 products will be displayed in one column. That means, with the shortcode
, the result will be as the below screenshot:
Paid Services – LearnWoo
$10
Add to cart
WooCommerce Google Analytics Pro Plugin
$79
Buy at WooCommerce.com
WooCommerce Product CSV Import Suite Plugin
$49
Buy at WooCommerce.com
WooCommerce Product Vendors Plugin
$79
Buy at WooCommerce.com
WooCommerce Checkout Field Editor Plugin
$49
Buy at WooCommerce.com
WooCommerce Customer / Order / Coupon Export Plugin
$79
Buy at WooCommerce.com
paginate
This attribute will help to divide the products into different pages. You can use this along with the limit attribute to specify how many products will be displayed in one page. Set paginate=”true” for it to work. So, for the shortcode
Showing 1–6 of 30 results
, the result will be as the below screenshot:
Paid Services – LearnWoo
$10
Add to cart
WooCommerce Google Analytics Pro Plugin
$79
Buy at WooCommerce.com
WooCommerce Product CSV Import Suite Plugin
$49
Buy at WooCommerce.com
WooCommerce Product Vendors Plugin
$79
Buy at WooCommerce.com
WooCommerce Checkout Field Editor Plugin
$49
Buy at WooCommerce.com
WooCommerce Customer / Order / Coupon Export Plugin
$79
Buy at WooCommerce.com
Change the order of display
While using WooCommerce shortcodes, you can also change the display of products as well. There are a few different conditions that you can specify in conjunction with the ‘orderby’ attribute. They are:
- id – sorts the displayed products by product id.
- title – arrange products by their title. This is the default order of orderby attribute.
- popularity – creates an order of products based on the number of purchases that has been made on your store. The most popular one will be displayed first.
- date – You can also order products by the date they were published. By default, the oldest product will be displayed first.
- menu_order – If you have set menu orders, this attribute will order products based on that. The lowest number will be displayed first.
- rating – You can sort products based on their average rating value using this attribute.
- rand – This attribute will change the order of the products every time the page is reloaded. Please note this may not work on sites that have enabled caching, as a specific order of products is saved in such cases.
You can even use these options together by adding them with a space between each other.
For example, the shortcode
will give you the products in an order based on their popularity.
Paid Services – LearnWoo
$10
Add to cart
Email Customizer for WooCommerce Subscriptions
$79
Buy at WooCommerce.com
Multi-Currency Switcher
$49
Buy at WooCommerce.com
Bulk Edit Products, Prices, and Attributes
$79
Buy at WooCommerce.com
Advanced Catalog Mode For WooCommerce
$79
Buy at WooCommerce.com