List of WooCommerce Shortcodes and Their Usage

Last updated on by admin

WooCommerce is a widely used free e-commerce/store plugin for WordPress. It comes with various shortcodes that can be used to customize your online store such as the interface, checkout functionality, product listing etc. In this article, I made a list of all the WooCommerce shortcodes and their usage so that new/advanced users can take full benefits from WooCommerce.

WooCommerce Page Shortcodes

When you first install WooCommerce it automatically creates 4 pages that are required to run your store – Shop, Cart, Checkout, and My Account. If a page is not created or you accidentally deleted it, you can recreate it with the proper shortcode and specify in the settings.

Shop

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 being rendered and list your products.

Cart

Cart page is used for the WooCommerce 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.

Checkout

Checkout page is used for the WooCommerce checkout functionality. This is the checkout shortcode:


[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.My Account

My Account

My Account page shows a dashboard to the logged-in customers. This is the 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.

Order Tracking Form

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 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 that are not limited to a particular page and can be used anywhere you want.

Recent Products

This shortcode can be used 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.

Featured Products

This WooCommerce shortcode can be used to display products that have been set as “featured” in WooCommerce.


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

Product

This WooCommerce 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.

Products

This WooCommerce shortcode allows you to show multiple products by ID or SKU.


[products ids="1, 2, 3, 4, 5"]


[products skus="foo, bar, baz"]

Add to Cart

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


[add_to_cart id="99"]

Add to Cart URL

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


[add_to_cart_url id="99"]

Product Category

This WooCommerce 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.

Product Categories

This WooCommerce 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 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, hover over the category and the ID appears in the URL.

Product Page

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


[product_page id="99"]


[product_page sku="FOO"]

Sale Products

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


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

Best-Selling Products

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


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

Related Products

This WooCommerce shortcode lists all of your related products.


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

Top Rated Products

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


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

Product Attribute

This WooCommerce shortcode lists products by attributes.


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

Product Sorting

Shortcodes that simply display multiple products or multiple products of a category can be sorted using the “orderby”/”order” parameter. 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"]

GET 70% OFF WordPress Hosting Here

Leave a Reply

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