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.
[woocommerce_cart]
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
Crayon Syntax Highlighter v2.7.1
[woocommerce_cart]
1 |
[woocommerce_cart] |
[Format Time: 0.0006 seconds]
[woocommerce_checkout]
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
Crayon Syntax Highlighter v2.7.1
[woocommerce_checkout]
1 |
[woocommerce_checkout] |
[Format Time: 0.0004 seconds]
[woocommerce_order_tracking]
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
Crayon Syntax Highlighter v2.7.1
[woocommerce_order_tracking]
1 |
[woocommerce_order_tracking] |
[Format Time: 0.0004 seconds]
[woocommerce_my_account]
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
Crayon Syntax Highlighter v2.7.1
[woocommerce_my_account order_count=”12″]
1 |
[woocommerce_my_account order_count=“12”] |
[Format Time: 0.0005 seconds]
[recent_products]
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
Crayon Syntax Highlighter v2.7.1
[recent_products per_page=”12″ columns=”4″]
1 |
[recent_products per_page=“12” columns=“4”] |
[Format Time: 0.0006 seconds]
[featured_products]
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
Crayon Syntax Highlighter v2.7.1
[featured_products per_page=”12″ columns=”4″]
1 |
[featured_products per_page=“12” columns=“4”] |
[product]
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
Crayon Syntax Highlighter v2.7.1
[product id=”99″]
1 |
[product id=“99”] |
Crayon Syntax Highlighter v2.7.1
[product sku=”ART103″]
1 |
[product sku=“ART103”] |
[products]
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
Crayon Syntax Highlighter v2.7.1
[products ids=”1, 2, 3, 4, 5″]
1 |
[products ids=“1, 2, 3, 4, 5”] |
Crayon Syntax Highlighter v2.7.1
[products skus=”ART12, ART22, ART50″ orderby=”date” order=”desc”]
1 |
[products skus=“ART12, ART22, ART50” orderby=“date” order=“desc”] |
[add_to_cart]
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
Crayon Syntax Highlighter v2.7.1
[add_to_cart id=”99″]
1 |
[add_to_cart id=“99”] |
[add_to_cart_url]
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
Crayon Syntax Highlighter v2.7.1
[add_to_cart_url id=”99″]
1 |
[add_to_cart_url id=“99”] |
[product_page]
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
Crayon Syntax Highlighter v2.7.1
[product_page id=”99″]
1 |
[product_page id=“99”] |
Crayon Syntax Highlighter v2.7.1
[product_page sku=”ART103″]
1 |
[product_page sku=“ART103”] |
[product_category]
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
Crayon Syntax Highlighter v2.7.1
[product_category category=”musik”]
1 |
[product_category category=“musik”] |
[product_categories]
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
Crayon Syntax Highlighter v2.7.1
[product_categories number=”12″ parent=”0″]
1 |
[product_categories number=“12” parent=“0”] |
[sale_products]
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
Crayon Syntax Highlighter v2.7.1
[sale_products per_page=”12″]
1 |
[sale_products per_page=“12”] |
[best_selling_products]
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
Crayon Syntax Highlighter v2.7.1
[best_selling_products per_page=”12″]
1 |
[best_selling_products per_page=“12”] |
[top_rated_products]
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
Crayon Syntax Highlighter v2.7.1
[top_rated_products per_page=”12″]
1 |
[top_rated_products per_page=“12”] |
[product_attribute]
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
Crayon Syntax Highlighter v2.7.1
[product_attribute attribute=”farbe” filter=”schwarz”]
1 |
[product_attribute attribute=“farbe” filter=“schwarz”] |
[related_products]
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
Crayon Syntax Highlighter v2.7.1
[related_products per_page=”12″ orderby=”title”]
1 |
[related_products per_page=“12” orderby=“title”] |
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.