WooCommerce Shortcodes to Individualize Pages

0
1239
Header image for WooCommerce shortcodes

Last updated - March 23, 2018

WooCommerce offers an elaborate list of shortcodes to help you insert content in your pages and posts. Even though WooCommerce comes with a sensible set of display options, you may want to customize the display even more. Shortcodes make it easy for you to specifically display products or a set of products according to requirements. They might be quite handy when you are trying to create landing pages for particular products part of marketing campaigns. Or, when you want to create a unique identity to your store. A little bit of programming knowledge will be really helpful when you are trying to deal with shortcodes. However, there are multiple plugins too which make use of shortcodes to provide different functionalities. This article should give you an idea of the diverse WooCommerce shortcodes that you can use in your store. We will also discuss the use of a few plugins that will help you in adding extra functionalities using shortcodes.

WooCommerce shortcodes for pages

Shortcodes for pages are usually added automatically when you use the WooCommerce setup wizard. If you want to know more, our other article on WooCommerce pages can also help. Still, to get a perspective, we will go through the WooCommerce shortcodes for pages here.

Cart

You can use this shortcode to specify a cart page for your store. The cart page shortcode helps to display the content on the cart. It also acts as an interface for customers to apply coupon codes and other necessary interactive elements on the page. There are no further arguments that you can combine with this shortcode.

Checkout

This shortcode helps you display the content of WooCommerce checkout page. Read our article on checkout page optimization if you are interested in knowing more.

My Account

This shortcode helps to display the account information for each customer. This includes past orders and user profile. By default, it will display 15 orders, which you can set to all orders using -1. Current user argument is automatically set.

Order tracking form

This one helps users to find the status of their orders by entering the relevant information related to that order.

WooCommerce shortcodes for products

In the latest versions of WooCommerce, products shortcode has undergone major changes and it replaces various other strings previously used. Instead, in the latest version of WooCommerce, you can use a combination of attributes along with [products]. WooCommerce documentation classifies the available product attributes shortcodes into three sections. Display, content, and special.

Display product attributes

Here is a list of the available attributed for display:

limit – helps to specify the number of products to display. If you want to display all, can use -1. eg: [products limit=”5″] will display 5 products.

columns – specify the number of columns to display. The default is 4.

orderby – this shortcode helps to sort the products by an option that you specify. You can even specify more than one options with a space between them. The available options to sort are date, id, popularity, menu_order, rand, rating, title etc. title is the default option to sort. popularity will be decided based on the number of purchases. rand is a random product order; it might not work if you use caching on your site.

eg: [products orderby=”popularity rating”]

skus – this one displays a comma-separated list of SKUs.

category – comma-separated list of category.

order – this gives an indication of whether the order of products is ascending or descending. By default, the order will be ascending.

class – it adds an HTML wrapper class, to help you modify the output with custom CSS.

Now, there are three attributes that you cannot use together. These are on_sale, best_selling and top_rated. You need to use these separately to display sale, best selling, and top rated products in your store.

Content product attributes

– helps you retrieve specific products based on the attribute.

terms – provides a comma separated list of terms that use with each attribute. You can also specify terms_operator to determine how products are excluded or included. This includes ‘AND’, ‘IN’ and ‘NOT IN’. ‘IN’ is the default term_operator value.

visibility – You can also set the visibility of products as well based on specified options. The available options are ‘visible’, ‘catalog’, ‘search’, ‘hidden’ and ‘featured’. Visible means the products are visible on shop and search results. Catalog means the products are visible on the shop page, but not in search results. Search option is the opposite – products will be visible on the search, but not on the shop page. Hidden option would make the product not visible on the search or on the shop page. Only someone with the url of the product will be able to access it.

category – helps you retrieve specific products based on a category. There is also a cat_operator available that determines how the categories will be displayed in combination. Similar to what we have seen in terms, these are ‘AND’, ‘IN’ and ‘NOT IN’.

ids – will display products based on a comma separated list of Product IDs.

skus – will display products based on a comma separated list of SKUs.

Special product attributes

best_selling – will display the best selling products on your store. You have to set it to ‘true’ eg: [products best_selling=”true”]

on_sale – will display the products from your store that are on sale. Similar to the above case, you need to set it to ‘true’.

Also note, you can’t use the special product attributes in combination with the content attributes. The special attributes need to be used separately.

Product Page shortcodes

If you want to display a single product page, you can do that based on the ID or SKU. The shortcode for this would be [product_page id=”75″] or [product page sku=”C22″].

Related products

This shortcode helps to list the related products on a product page. You can use different arguments like ‘limit’, ‘columns’ and ‘orderby’ in conjunction with this. eg: [related_products limit=”8″].

Add to Cart

This helps to display the price and add to cart button for a specific product. You can specify the product by ID. eg: [add_to_cart id=”75″].

Add to Cart url

This helps to echo the url on the add to cart button of a single product. You an specify the product by ID> eg: [add_to_cart_url id=”75″].

Display notifications on non WooCommerce pages

Sometimes you need to display notifications on certain pages other than the default WooCommerce pages. [shop messages] will help you get this done. For example, when you are using other shortcodes like add_to_cart, this can be quite handy.

WooCommerce shortcodes can be really useful when you are trying to individualize the product display on your store. If you want to read more examples and real life scenarios, this WooCommerce documentation can help a lot.

WooCommerce Shortcodes Plugins

WooCommerce community has a few plugins that make use of shortcodes for different functionalities. Let’s take a look at some of them.

Shortcodes for Visual Composer

This plugin provides a simple and efficient way to add shortcodes on Visual Composer. It will help you customize the front end of your store in a more organized way as you desire. However, you may need to note the plugin only helps to add shortcodes to visual composer. The elements of your front end will be majorly dependent on theme that you are using. If you are looking for some awesome WooCommerce themes, checkout our article.

This plugin helps to add WooCommerce shortcodes to Visual Composer.

Coupon Shortcodes

The plugin helps to provide coupon information to customers so that there are more chances to convert. It also helps to display content based on the availability of valid coupons. You can encourage customers to complete the order by providing specific coupons according to the content of their cart. Similarly, you can motivate them to increase the order value so that they can apply a specific coupon. The plugin provides a set of conditional shortcodes, which you can use to set options as you desire. You can allow display specific content depending on whether customer applies the coupon or not. Similarly, you can also selectively display content based on the validity of the coupon as well.

These are the available shortcodes – [coupon_is_applied], [coupon_is_not_applied], [coupon_is_valid], [coupon_is_not_valid]. You can also provide information on the coupons using a few other shortcodes such as [coupon_code], [coupon_description] and [coupon_discount]. Additionally, you will be able to display all the coupons or a set of coupons using [coupon_enumerate].

This free WordPress plugin provides shortcodes to selectively display coupon information to customers.

If you are wondering how an effective coupon strategy can help with the marketing efforts of your store, please read our article on WooCommerce coupon management.

My Downloads Shortcode

If you are selling downloadable products on your store, this plugin can be quite handy. It helps to display the available downloads for logged in users, outside the My Account page. The shortcode [woocommerce_my_downloads] displays the date of the order and the file name in an un ordered list.

This free WordPress plugin helps to add available downloads outside the My Account page of WooCommerce.

If you are looking for some specific tips on how to sell digital downloads, another article may help you.

SIP Reviews Shortcode

This plugin helps to display product reviews anywhere on your WooCommerce store. The highly customizable plugin allows to insert product schema as well. It is a great tool for your marketing efforts. For example, if you have a custom landing page, you will be able to insert product reviews on the page using a shortcode. Or, if you want to embed your reviews section on a blog page, you can do that with this plugin. The plugin takes away the manual effort needed to display product reviews elsewhere on the site.

SIP Reviews shortcode plugin offers a seamless integration with most of the popular WooCommerce themes. This is achieved by the unique color customization feature of the plugin. Additionally, it allows you to get product schema in any page. By default, WooCommerce has product schema on the product page. If you want it to be there on any other page based on your requirements, you can have it. You can purchase a regular license of the plugin for $16. You will get six months of support with the purchase. However, if you want to opt for extended support for another 12 months, you can pay $4.50 to get it.

Conclusion

WooCommerce offers great options to configure and customize an online store. However, the beauty of WooCommerce lies in how it incorporates additional modifications and customization. WooCommerce shortcodes are one such feature that provides awesome flexibility to individualize your store. In the latest versions, WooCommerce has really simplified the use of shortcodes. This article has covered the available shortcodes for the latest versions of WooCommerce. On a different note, we have also covered some of the plugins that use shortcodes to extend the functionalities of the store. Let’s know if you want to add an insight to this article.