WooCommerce Shortcodes – A Comprehensive Guide to Using Shortcodes

by | Oct 7, 2018 | e-Commerce | 0 comments

Lives of countless site managers were made easy when WordPress introduced shortcodes with platform version 2.5. It is one of the most useful features of the CMS, and has made its way into WooCommerce as well, where it finds a lot of utility.

A combination of WordPress, WooCommerce and an attractive ecommerce theme can be used to create a professional online store. With the help of WooCommerce shortcodes, users can create unique pages that have distinctive design and functionality.

In this post we’ll explain WooCommerce shortcodes in depth, what their purpose is and how to use them (effectively).

What are WooCommerce Shortcodes?

The first thing you need to realize is that the shortcode is not a WooCommerce feature, rather, it’s a feature that’s found in WordPress. Since WooCommerce is essentially an extension of WordPress, and also uses its CMS capabilities, the shortcodes feature is naturally available to its users as well.

So shortcodes then, what are they? To put it briefly, shortcodes act like shortcuts that you can use to call a specific function within posts or pages. This can perhaps be better explained with an example.

Let’s consider a shortcode which allows you to embed a Youtube video to your page. Normally, you’d have to copy-paste a special embed code to the HTML of your page. With shortcodes however, you’ll just have to paste something like this:

[youtube-video url=”XURL]

Now as you can see, the shortcode makes it much simpler to embed the Youtube video. Not only that, but it also looks better while you’re developing your WooCommerce page.

How do Shortcodes Work?

Shortcodes are actually just shortcuts to programmed functions, as they invoke those functions when a web page is loading.

Types of Shortcodes

Shortcodes are written in square brackets as such: [shortcode]. However, there are several kinds of shortcodes which can be used within WooCommerce.

Simple Shortcodes

The simplest form of shortcodes involves just a shortcode within square brackets. For example:

The above shortcode will simply embed an image gallery within a page. There is no way of specifying which gallery to embed, and that leads us to our second type of shortcode.

Shortcodes with Parameters

Shortcodes can have parameters which can be used to specify ‘settings’ for the function they’re being used for. Continuing with our gallery shortcode example, parameters can be specified to sort the images within the gallery being embedded.

[gallery order=”DESC” orderby=”post_date”]

The above shortcode has the parameters ‘order’ with value ‘DESC’, and ‘orderby’ with value ‘post_date’. This means that images within that gallery will be sorted in a descending order according to the date they were uploaded/posted.

Shortcodes with Content

Shortcodes can be used to ‘wrap’ around content, for additional functionality. For example, the caption shortcode can be used to display a captioned image:

<img src=”www.logicinbound.com/image.jpg/” />Content

With some parameters:

<img src=”www.logicinbound.com/image.jpg/” />Content

How to Add Shortcodes to Pages

You can manually add any shortcode to any WordPress page, and it’s quite a simple process. In the context of WooCommerce shortcodes, you might want to use WooCommerce shortcodes to create ecommerce-related pages.

In this example, we’ll be creating a checkout page using a simple WooCommerce shortcode.

First of all, let’s create a new page that will serve as the template for our checkout page. To do this, navigate to Pages -> Add New from your WordPress admin dashboard.

For this example, let’s name the title of the page as ‘Checkout’.

Now go to the visual editor of the page, and paste the following shortcode:

[woocommerce_checkout]

In the visual editor it should look something like this:

Go ahead and publish the page to view the checkout. Please note that the checkout page will be empty if you have an empty cart.

WooCommerce Shortcodes Plugin

To make life easier, we recommend you to install the WooCommerce Shortcodes plugin so you have easy access to most of the shortcodes we’ll be talking about in this post.

This WooCommerce plugin provides a dropdown button in your WordPress text editor with the shortcodes all ready for you to use. With this, there’s no need to remember the shortcodes and their arguments!

To install this plugin, simply access your WooCommerce/WordPress admin dashboard, and navigate to Plugin > Add New. Here, type in ‘WooCommerce Shortcodes’ in the search box:

The search result you’re looking for should be simply called ‘WooCommerce Shortcodes’ by WooThemes, as shown in the image above. If you’ve found the correct plugin, proceed to install it by clicking the ‘Install Now’ button. After installing it, make sure to activate it!

That’s it! You should now have a tiny dropdown button in whichever WordPress text editor you’re using:

WooCommerce Page Shortcodes

Let’s look at the page shortcodes available in WooCommerce:

  1. Cart – [woocommerce_cart]

This shortcode is used to display cart content and the interface for coupon codes and other cart-related elements. There are no parameters for this shortcode.

     2. Checkout – [woocommerce_checkout]

This shortcode displays the checkout page, and there are no parameters available for it.

    3. My Account – [woocommerce_my_account]

This shortcode displays the ‘my account’ section, where the customer can view their placed orders and also update their personal information.

   4. Order Tracking – [woocommerce_order_tracking]

This shortcode displays a form which can be used to check status of an order by entering order details (Order ID and Billing Email).

A useful tidbit regarding page shortcodes is that you can combine these to form a better page for your store’s visitors. For example, combining My Account shortcode with Order Tracking will result in a better user experience as the user can check their order history and check the status of an order from the same page.

WooCommerce Add to Cart / Product Price Shortcode

This shortcode allows you to show the price and picture of a product, along with a ‘Add to Cart’ button. The product has to be specified by its ID using this shortcode.

[add_to_cart id=”99”]

WooCommerce Product Shortcodes

The product shortcodes is one of the most useful shortcodes available in WooCommerce, as it allows you to display products by ID, SKU, category and has support for pagination as well. With the [products] shortcode, there is no need to fiddle with old product shortcodes such as [featured products], [sale_products], [best_selling_products] and such.

Product Shortcode Examples –  Random Sale Items

In this example, we’ll display four random products that are on sale.

[products limit = “4” columns = “4” orderby = “popularity” on_sale = “true”]

The above shortcode explicitly states there be 4 products that will be displayed across 4 columns. If there are more than 4 products, they will appear in the next row. However, in this case, the products will only appear as one row.

Product Shortcode Examples – Featured Products

To display featured products, we simply specify a special argument ‘visibility’ in the products shortcode:

[products limit = “4” columns = “2” visibility = “featured”]

The above shortcode specifies that there should be 4 products that will be displayed across two columns, which in turn means that there will be 2 rows of products (containing 2 products each). The visibility argument specifies that the products should be featured.

Product Shortcode Examples – Best Selling Products

To display top 4 best-selling products, we will use the products shortcode with the ‘best_selling’ argument.

[products limit = “4” columns = “4” best_selling = “true”]

The above shortcode will display 4 products across 4 columns, which will be displayed in 1 row.

WooCommerce Shortcodes for Product Category

The category shortcodes allow you to display product categories on any page.

  • [product_category] – Displays products in a specified product category.
  • [product_categories] – Displays all product categories.

The [product_category] shortcode can take accommodate the following attributes:

  1. ‘number’ => ‘null’ – Specify the number of categories using this attribute.
  2. ‘orderby’ => ‘name’ – Specify the order using this shortcode. ‘Name’ and ‘date’ can be used for this.  
  3. ‘order’ => ‘ASC’ – Specify how the product categories will be ordered. ‘ASC’ and ‘DESC’ can be used for this.
  4. ‘columns’ => ‘4’ – Specify the number of columns the categories will be organized into.
  5. ‘hide_empty’ => ‘1’ – Specify whether to show or hide categories with no products. Set to ‘1’ to hide empty categories or ‘0’ to show them.

Why are WooCommerce Shortcodes Not Working? / Troubleshooting Shortcodes

If you copy and pasted a shortcode correctly inside your page but it does not render properly upon publishing, you might need to check if the shortcode has been embedded between <pre> tags.

To check this, open the ‘Text’ tab of the visual editor for your page, and remove the <pre> and </pre> tags surrounding the shortcode:

Source: woocommerce.com

This is a common issue that happens to many users, so make sure that it’s not causing your shortcodes to display incorrectly.

Conclusion

WooCommerce shortcodes provide a convenient way of creating ecommerce pages with minimum amount of fiddling about. Sure, it’s hard to remember all of the shortcodes but that’s why we recommend that you install the WooCommerce Shortcodes Plugin.

If you’d like to see how WooCommerce fares against other ecommerce platforms, check out our comprehensive comparison articles for WooCommerce vs Shopify and WooCommerce vs Magento.

Best Ecommerce Platform for Your Business

Best Ecommerce Platform for Your Business

Shopify or BigCommerce? Wix or Volusion? We compare some of the most popular hosted ecommerce platforms and give our recommendation ones that provide great value to small businesses.

How to Increase Your Customer Lifetime Value with Email Marketing

How to Increase Your Customer Lifetime Value with Email Marketing

There are businesses that spend all their money and resources on acquiring new customers, and there are ones that focus on retaining their existing customers as well. Growing your business by acquiring new customers exclusively is an expensive proposition. Customer...

Hunter.io Review

Hunter.io Review

We do a significant amount of outreach everyday here at Logic Inbound, so I’m always on the lookout for tools that will make that a little easier. Being a digital marketing agency focused on healthcare clients, we reach out to hundreds of doctors every month, and with...

7 Etsy SEO Tips to Help Your Products Get Found Quickly

7 Etsy SEO Tips to Help Your Products Get Found Quickly

You've probably heard about SEO before, and if you're reading this article, chances are you know its benefits and application. But, do you know how to effectively apply an SEO strategy to your Etsy shop? Well, not everyone does, and we are here to change this! A good...

How to Make Beautiful Blog Thumbnails Easily in Less Than 2 Minutes

Make beautiful and attention-grabbing blog thumbnails that will increase your user traffic.

WooCommerce Subscriptions: Best Subscription Plugins for Woocommerce

Do you want to start offering subscription products on your WooCommerce store? By default, this functionality is absent in WooCommerce. However with the right subscription plugins, you can offer any kind of subscription-based products. Find out our recommendations for best WooCommerce subscription plugins.

Shopify POS: Shopify POS Explained

Shopify represents one of the easiest ways of creating a professional online store. To facilitate merchants selling products in physical locations, Shopify comes with its own point of sale system. Read on to find out if Shopify POS performs as well as rest of the platform does.

Increase Blog Post Rankings With These Simple Tips

So you’ve been writing beautiful blog posts for a few years and now you need them to rank. You’ve got answers to questions, and people searching the internet should find you first, right? Right! Let’s talk about how we can rank blog posts. As of late, I’ve written and...

Shopify Pricing – Shopify Price Plans Explained

We compare Shopify price plans and discuss in detail what they have to offer in terms of features and value to the user.

WooCommerce Plugins: Free, Premium, Best, and Top Plugins

With thousands of plugins to choose from, WooCommerce users certainly have no shortage of options. But which plugins are the best? Which plugins should every WooCommerce site have? In this roundup, we list the essential WooCommerce plugins – both free and paid – that every Woo site owner should have.

Shopify Pricing – Shopify Price Plans Explained

We compare Shopify price plans and discuss in detail what they have to offer in terms of features and value to the user.

Outsource Marketing: When You Should Do It and Which Tasks to Start With First

Building a business has potential to be your greatest accomplishment, but it can take a lot of your time, especially when it comes to outsourcing marketing. From sending out sales emails to keeping customers happy to managing social media channels, it can start to...

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Evergreen Topics to Write About – Guide to find them for ANY Industry

Learn how to find ideas and write content that will stay relevant for years to come.

4 Simple Tweaks You Should Use to Increase Your E-Commerce Conversion Rate

Converting visitors into paying customers can be incredibly challenging for most ecommerce business owners. We list 4 simple and actionable tips that will help your store get a better conversion rate.

Pinterest SEO Guide

Pinterest SEO Guide Most people are familiar with talking about SEO as it relates to websites and Google searches. But the principles of SEO can also apply to non-traditional websites such as Pinterest, the project and idea sharing platform. Pinterest is a great way...

These 5 Essentials Will Take Your Mobile Marketing From Good To Mind-Blowing

There are over 3.8 billion unique mobile phone users in the world, and in places like China, 98% of internet users browse the web via their mobile devices. Any successful marketing strategy will have to take this reality into account in order to be successful in this...

What is Shopify Flow?: A New Ecommerce Automation & Marketing App for Shopify Plus Members

Flow for Shopify Plus is an automation tool that helps free up valuable time and resources by letting the platform take care of repetitive ecommerce tasks.

What is Spotify Ad Studio?: Self-Serve Ads Platform For Brands That Makes Advertising Easy

Learn all about Spotify Ad Studio and how to use it to create successful voice ad campaigns.

“Reviews from the Web” — Google now shows reviews from facebook and other websites in search results

Learn what the Google ‘Knowledge Panel’ can do for your business, and how to use it to get even more business.

The ULTIMATE Guide to Managing Multiple Shopify Stores in 2019

Having trouble managing several Shopify stores at once? Read this guide to find out actionable tips that make managing multiple Shopify stores easier.