WooCommerce Shortcodes Tutorial: How to Add a WooCommerce Shortcode

Do you want to increase customer conversion rates in your online store? Are you not being able to customize your store the way you want? In this post, I will help you find the right WooCommerce shortcode for a specific functionality so you can easily make your store more professional.

WooCommerce Shortcodes Tutorial

This video will show you how you can install the WooCommerce shortcodes plugin and insert a WooCommerce shortcode of your choice into a page easily.

WooCommerce Shortcodes for Pages

woocommerce shortcodes list

When you first install WordPress it automatically creates 4 pages that are required to run your store – Shop, Cart, Checkout, and My Account. These pages have shortcodes that WooCommerce includes from its core. So if WooCommerce couldn’t create a page for some reason or you accidentally deleted it, you can recreate it with the proper shortcode and specify in the settings.

WooCommerce Shop Shortcode

Shop page is your store page. It showcases all of your WooCommerce products and presents to your visitors. Currently, there is no shortcode to customize the content of this page. WooCommerce can automatically detect when the shop page is loading and list your products accordingly.

WooCommerce Cart Shortcode

WooCommerce creates a Cart page for its shopping cart functionality. This is the cart shortcode:

[woocommerce_cart]

The cart shortcode does not accept any additional parameter/argument. It shows the content of the shopping cart such as item details, coupon codes, shipping, taxes etc.

WooCommerce Checkout Shortcode

Checkout page provides the checkout functionality for your customers. This is the WooCommerce shortcode for the checkout page:

[woocommerce_checkout]

The checkout shortcode does not accept any additional parameter/argument. It shows all the information which will be collected from a user during checkout such as billing info, shipping info, payment method etc.

WooCommerce My Account Shortcode

My Account page shows a dashboard to the logged-in customers. This is the WooCommerce shortcode for the My Account page:

[woocommerce_my_account]

A customer can view their past orders, downloads, and update their personal details such as billing info, shipping info, account password from the My Account page.

WooCommerce Order Tracking Form Shortcode

Order Tracking Form page is not created automatically by default. This is an optional page that you can manually create to let a customer check the status of an order. This is the WooCommerce shortcode for the Order Tracking Form page:

[woocommerce_order_tracking]

In order to see the status of an order, the customer needs to enter their order details in the Order Tracking Form.

Other WooCommerce Shortcodes

There are some WooCommerce shortcodes which can be used anywhere you want.

WooCommerce Recent Products Shortcode

You can use this WooCommerce shortcode to list a set of recent products.

[recent_products per_page="12" columns="4"]

You determine how many products to show on the page with the “per_page” attribute. The “columns” attribute can be used to control how many columns wide the products should be before wrapping.

WooCommerce Featured Products Shortcode

You can use this WooCommerce featured products shortcode to display products that have been set as “featured” in WooCommerce.

[featured_products per_page="12" columns="4"]

WooCommerce Product Shortcode

This WooCommerce single product shortcode allows you to show a single product by ID or SKU.

[product id="99"]
[product sku="FOO"]

In order to find the ID of a product, you can hover over that particular product in the WooCommerce Products menu.

screenshot showing how to find the id of a WooCommerce product

WooCommerce Products Shortcode

This WooCommerce product display shortcode allows you to list multiple products by ID or SKU.

[products ids="1, 2, 3, 4, 5"]
[products skus="foo, bar, baz"]

WooCommerce Add to Cart Shortcode

This WooCommerce add to cart button shortcode shows the price and add to cart button of a single product by ID.

[add_to_cart id="99"]

WooCommerce Add to Cart URL Shortcode

This WooCommerce add to cart shortcode prints the URL on the add to cart button of a single product by ID.

[add_to_cart_url id="99"]

WooCommerce Product Category Shortcode

This WooCommerce category shortcode shows multiple products of a category by slug.

[product_category category="appliances"]

You can find the slug of a particular category under WooCommerce > Products > Categories.

WooCommerce Product Categories Shortcode

This WooCommerce category shortcode can display multiple product categories in a loop.

[product_categories number="12" ids="2, 6, 7, 10"]

You can use the number parameter to display the number of products, and the ids field (containing a comma-separated list of category IDs) to choose which categories to display.

There is also the parent parameter that you can set to 0 to only display the top level categories.

[product_categories number="12" parent="0"]

In order to find the ID of a category, go to the Product Categories screen and hover over the category. The ID appears in the URL.

WooCommerce Product Page Shortcode

This WooCommerce shortcode shows the full product page of a WooCommerce product by ID or SKU.

[product_page id="99"]
[product_page sku="FOO"]

WooCommerce Sale Products Shortcode

This WooCommerce products sale shortcode showcases all of your products that are on sale.

[sale_products per_page="12" columns="4"]

WooCommerce Best-Selling Products Shortcode

This WooCommerce top selling product shortcode showcases all of your best-selling products.

[best_selling_products per_page="12" columns="4"]

WooCommerce Related Products Shortcode

This WooCommerce shortcode lists all of your related products.

[related_products per_page="12" columns="4"]

WooCommerce Top Rated Products Shortcode

This WooCommerce shortcode showcases all of your top-rated products.

[top_rated_products per_page="12" columns="4"]

WooCommerce Product Attribute Shortcode

This WooCommerce shortcode lists products by attributes.

[product_attribute attribute="color" filter="black"]

WooCommerce Product Sorting

You can use the “orderby” or “order” parameter to sort shortcodes that simply display multiple products or multiple products of a category. The “orderby” parameter can accept one of these values:

  • menu_order
  • title
  • date
  • rand
  • id

The “order” parameter can accept one of these values:

  • asc
  • desc

For example: This shortcode will sort 3 products (with SKUs foo, bar and baz) by date in descending order:

[products skus="foo, bar, baz" orderby="date" order="desc"]
Disclosure: This page may contain affiliate links. If you follow one of those affiliate links and purchase something it will provide me with a little bit of a commission. This costs you nothing extra but helps maintain my site, free plugins, and themes. So I thank you for your support.

2 thoughts on “WooCommerce Shortcodes Tutorial: How to Add a WooCommerce Shortcode”

  1. This is been a great find. Thanks for sharing your knowledge!

    Reply
  2. Hey there,

    Thanks for making this article.

    We have a custom tab in the My Account page where we’d like the Tracking Form to be displayed.

    However when the form is submitted the page is refreshed and we are on the default /my-account/ page. I’m guessing this is because the shortcode is displayed on an endpoint rather than an actual page.

    Would you have any clue to make that work on a custom tab inside My Account?

    Thank you!

    Reply

Leave a Reply to Bill Bowman Cancel reply