Useful shortcodes for WordPress and WooCommerce

Shortcodes is a wordpress little bits code which allow you to run complex commands inside WordPress posts, pages, and widgets. It allows developer to execute code without writing code themselves.

Why use Shortcodes?

  • Allow users who don't have any technical skill and experience to make their website dynamic.
  • Also this wordpress default. So it available free of charge.
  • shortcodes provide a lot of functionality.
  • Instead of shortcodes usage of custom plugins might slow down the website speed.

How to use Shortcodes in WordPress?

To use a shortcodes you just need to insert it into a WordPress page or post. A shortcodes is used as a bracketed tag “ [ ] “ embedded inside a post or page.

Here we show to some excellent WordPress Shortcodes. You can use it as per your requirement.

1. Video Shortcodes

  • [] -   This Shortcode embeds a video
  • flickr -    This Shortcode embeds a Flickr video
  • While [vine] -  This Shortcode embeds a Vine video

2. Audio Shortcodes

  • soundcloud -  This Shortcode embeds music/demos from SoundCloud
  • [spotify] -  This Shortcode embeds music from Spotify

3. Image And Document Shortcodes

  • gallery - This Shortcode display an image gallery attached to post or page
  • [slideshare] - This Shortcode embed a slideshow from SlideShare
  • [googleapps] - This Shortcode embed your Google Docs spreadsheets, documents and presentations into your WordPress blog

Here we tend to show to some wonderful Woocommerce Shortcodes. You'll be able to use it as per your demand.

1. My Account

  • [woocommerce_my_account] - This Shortcode display ‘my account’ section where the customer can view past orders and update their information.

2. Cart Page

  • [woocommerce_cart] - This Shortcode used on the cart page of your WooCommerce to displays cart content and interface for coupon codes and other cart bits and pieces.

3. Checkout Page

  • [woocommerce_checkout] -  This Shortcode used on the checkout page to displays the checkout process.

4. Order Tracking Form

  • [woocommerce_order_tracking] -  This Shortcode used to display status of an order when user entering their order details.

5. Products Display

This Shortcodes used to display products by post ID, SKU, categories and attributes with support for pagination, random sorting and product tags.

  • [featured_products]
  • [sale_products]
  • [best_selling_products]
  • [recent_products]
  • [product_attribute]
  • [top_rated_products]

If you want to create your own shortcodes in wordpress then let’s see how to do it.

Add below code in your function.php file of your active child theme or parent theme.

function lorem_function() {
  return ' your shortcode content - whatever you display write here.' ;
add_shortcode('lorem', 'lorem_function');

In this code, add_shortcode takes two arguments, the first one being the name we want this shortcodes in square brackets in your post or page and the second one being the function we want to attach to that shortcodes.

After saving function.php file add below line of code in your post or page whenever you display a message as per your requirement.


I hope this post helpful for your website. If you have any query or need any help then contact our experience wordpress developer who can solve your query easily. We are team of experienced WP developer at Lathiya Solutions Surat.