Blog

WooCommerce Shortcodes – the ultimate list

Now that you have learnt the basics of WooCommerce shortcodes in our first segment, we can take a look at which shortcodes have already been implemented by WooCommerce.

Instructions for this list: We have clearly displayed the shortcodes in a table for quick reference. You will also find the exact description for each one. Click on a shortcode in the table to jump to its description.

The first four shortcodes are used for special WooCommerce pages and are sometimes automatically inserted into the pages by WooCommerce during installation. They should not otherwise be used. All others can be used throughout and can be used more than once.
 

Shortcodes for WooCommerce sites only

Shortcode Parameter Meaning
woocommerce_cart none Shows the content of the cart page.
woocommerce_checkout none Shows the content of the checkout page.
woocommerce_order_tracking none Shows the user a form with which he can enquire about the status of his orders.
woocommerce_my_account current_user, order_count Shows the content of the user account page.

 

Non-specific WooCommerce shortcodes

Shortcode Parameter Meaning
recent_products per_page, columns, orderby, order Shows new products.
featured_products per_page, columns, orderby, order Shows featured products.
product id or sku Shows a single product.
products ids or skus, columns, orderby, order Shows several predetermined products.
add_to_cart id or sku, style Shows the price and the “add to cart” button of a single product.
add_to_cart_url id or sku Displays the URL of the “add to cart” button of a particular product in text form.
product_page id or sku Shows the detail page of a product.
product_category per_page, columns, orderby, order, category Shows the products in a category.
product_categories number, orderby, order, columns, hide_empty, parent, ids Shows existing product categories.
sale_products per_page, columns, orderby, order Shows products on offer.
best_selling_products per_page, columns Shows best-selling products.
top_rated_products per_page, columns, orderby, order Shows top-rated products.
product_attribute per_page, columns, orderby, order, attribute, filter Shows products with a particular attribute.
related_products per_page, columns, orderby Shows related products.
Note: The parameters orderby and order are WordPress-specific and are described in more detail in the Codex.

 

Your cart is currently empty.

Your cart is currently empty.

Return To Shop

Shows the content of the cart page and everything that comes with it; list of products in the basket, voucher entry, shopping cart total, Proceed to checkout button, product recommendation etc. This shortcode will be automatically inserted into the cart page when installing WooCommerce.

Parameter

  • none

Example

 

Shows the content of the checkout page and everything that comes with it; invoice details, order overview Continue button etc. This shortcode will be automatically inserted into the checkout page when installing WooCommerce.

Parameter

  • none

Example

 

To track your order please enter your Order ID in the box below and press the "Track" button. This was given to you on your receipt and in the confirmation email you should have received.

Shows the user a form with which he can enquire about the status of his orders by stating the order number and email address. After entering the data, the customer is redirected to a page that displays the status and a summary of the order.

Parameter

  • none

Example

 

Login

Shows the content of the My Account page and everything that comes with it; overview of past orders, billing address and delivery address etc. The customer can also edit his data here. This shortcode will be automatically inserted into the My Account page when installing WooCommerce.

Parameter

  • current_user
    default: ''
    The customer whose My Account page is to be displayed.
    This is determined automatically using the function get_user_by get_user_by( ‘id’, get_current_user_id() )
  • order_count
    default: 15
    Number of orders to be displayed, -1 for the display of all orders.

Example

 

Shows recently added products, sorted according to various criteria. For presentation purposes you can specify the number of products to be displayed per page and the number of columns.

Parameter

  • per_page
    default: 12
    Number of products displayed per page.
  • columns
    default: 4
    Number of columns.
  • orderby
    default: date
    Sort key.
  • order
    default: desc
    Sort order.

Example

 

Shows featured products, sorted according to various criteria. For presentation purposes you can specify the number of products to be displayed per page and the number of columns. Comparable to recent_products.

Parameter

  • per_page
    default: 12
    Number of products displayed per page.
  • columns
    default: 4
    Number of columns.
  • orderby
    default: date
    Sort key.
  • order
    default: desc
    Sort order.

Example

 

Shows a single product that is specified by the ID or the item number (SKU). Make sure the catalog visibility is not set to hidden or the product will not be shown. The ID of a product can be determined in the dashboard on the product page. It will be displayed when you hover the mouse over the product in the name column. You can find the item number in the Art.-Nr. column.

Parameter

  • id
    default: ''
    Product ID
  • sku
    default: ''
    Product item number

Examples

 

Displays several products, which are specified by their IDs or by their item number (SKU). Make sure the catalog visibility is not set to hidden or the product will not be shown. Comparable to product.

Parameter

  • id
    default: ''
    Product ID
  • sku
    default: ''
    Product item number
  • columns
    default: 4
    Number of columns.
  • orderby
    default: title
    Sort key.
  • order
    default: asc
    Sort order.

Examples

 

Shows the price and the Add to Cart button of a product, which is specified by the ID or the item number (SKU). The style parameter can be used for formatting.

Parameter

  • id
    default: ''
    Product ID
  • sku
    default: ''
    Product item number
  • style
    default: border:4px solid #ccc; padding: 12px;
    Formatting

Example

 

Displays the URL of the add to cart button of a particular product in text form. The product is specified by the ID or the item number (SKU).

Parameter

  • id
    default: ''
    Product ID
  • sku
    default: ''
    Product item number

Example

 

Shows the detail page of a product which is specified by the ID or the item number.

Parameter

  • id
    default: ''
    Product ID
  • sku
    default: ''
    Product item number

Examples

 

Shows the products in a category which are specified by their permalink (slug). You can find the permalink in the dashboard under Products → Categories in the column Permalink.

Parameter

  • per_page
    default: 12
    Number of products displayed per page.
  • columns
    default: 4
    Number of columns.
  • orderby
    default: title
    Sort key.
  • order
    default: desc
    Sort order.
  • category
    default: ''
    Category slug.

Example

 

Displays the product categories with the category image and if desired the number of products contained in each of the categories.

Parameter

  • number
    default: null
    Number of categories to be displayed. If null, then all are displayed.
  • columns
    default: 4
    Number of columns.
  • orderby
    default: name
    Sort key.
  • order
    default: asc
    Sort order.
  • hide_empty
    default: 1
    Specifies whether or not to display empty categories. 1 for yes, 0 for no.
  • parent
    default: ''
    If set to 0, only top level categories will appear.
  • ids
    default: ''
    The Ids of categories to be displayed. If not specified, all categories will be included.

Example

 

Shows the products that are currently on offer, sorted according to various criteria. For presentation purposes you can specify the number of products to be displayed per page and the number of columns.

Parameter

  • per_page
    default: 12
    Number of products displayed per page.
  • columns
    default: 4
    Number of columns.
  • orderby
    default: title
    Sort key.
  • order
    default: asc
    Sort order.

Example

 

Shows best-selling products. The number of products displayed per page and the number of columns can be specified here.

Parameter

  • per_page
    default: 12
    Number of products displayed per page.
  • columns
    default: 4
    Number of columns.

Example

 

Shows top-rated products. Sorting according to various criteria possible.

Parameter

  • per_page
    default: 12
    Number of products displayed per page.
  • columns
    default: 4
    Number of columns.
  • orderby
    default: title
    Sort key.
  • order
    default: asc
    Sort order.

Example

 

Shows products with a particular property and the specified values for that property. Sorting according to various criteria possible.

Parameter

  • per_page
    default: 12
    Number of products displayed per page.
  • columns
    default: 4
    Number of columns.
  • orderby
    default: title
    Sort key.
  • order
    default: asc
    Sort order.
  • attribute
    default: ''
    The property that the products must have in order to be displayed.
    They will only appear if the parameter is used.
  • filter
    default: ''
    The value of the property the products must possess in order to be displayed.
    They will only appear if the parameter is used.

Example

 

Shows similar products. Similar products are determined on the basis of categories and tags. This shortcode must be used within a product detail page.

Parameter

  • per_page
    default: 2
    Number of products displayed per page.
  • columns
    default: 2
    Number of columns.
  • orderby
    default: rand
    Sort key.

Example

Caution: The per_page parameter specifies how many items to display on a page. The pagination function is not automatically generated. The per_page and columns parameters determine how many products and columns will be displayed. Whether this actually works and for which parameter values, is highly dependent on the layout of your theme. This requires some trial and error and reworking of the CSS.

The original documentation can be found on these WooThemes pages. Some shortcodes have been removed since WooCommerce 2.1.x. These shortcodes have not been described here. If required, you can also find them in the WooThemes documentation.

Post Sharing

Author Avatar

Life is great with family, WordPress, and a little chocolate. MarketPress supporter, blogger, and co-founder of WordPress Meetup Franconia – and last but not least: Google is my friend and helper.

Also Interesting

New Plugin: Slack Connector - Connect WordPress, WooCommerce and Slack

by Michael Firnkes

Initially we merely wanted to optimize our own Slack-processes. With automated notifications from our MarkettPress shop, the blog and our forums. The resul ...

Read more

Role Based Prices for WooCommerce is available again: Different prices for different customer groups

by Michael Firnkes

You want different prices for different customers and users of your online shop? E.g. for subscribers or wholesaler? Or do you need bulk prices? A lot of o ...

Read more

WooCommerce Weekly Review #7: Woo vs Magento, shop security and customer confidence

by Michael Firnkes

What is a WooCommerce shop in practice? And how do you protect it against external attacks? This and more in our Weekly Review. WooCommerce vs Magento: ...

Read more

WooCommerce Weekly Review #6: Translations, WordCamp Switzerland & avoiding legal warnings

by Michael Firnkes

WooCommerce was a hot topic at WordCamp in Switzerland. Progress is being made with the system translations and there are lots of useful new extensions. Th ...

Read more