Shortcodes included with WooCommerce

Shortcodes included with WooCommerce

Page Shortcodes:

[woocommerce_cart]

– shows the cart page

[woocommerce_checkout]

– shows the checkout page

[woocommerce_order_tracking]

– shows the order tracking form

[woocommerce_my_account]

– shows the user account page


Cart

Used on the cart page, the cart shortcode displays cart content and interface for coupon codes and other cart bits and pieces.

[woocommerce_cart]

Checkout

Used on the checkout page, the checkout shortcode displays the checkout process.

[woocommerce_checkout]

Order Tracking Form

Lets a user see the status of an order by entering their order details.

[woocommerce_order_tracking]

My Account

Shows the ‘my account’ section where the customer can view past orders and update their information. You can specify the number of orders to show. By default, it’s set to 15 (use -1 to display all orders.)

[woocommerce_my_account]

Recent Products

Lists recent products – useful on the homepage. The ‘per_page’ shortcode determines how many products to show on the page and the columns attribute controls how many columns wide the products should be before wrapping.

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


Featured Products

Works the same as recent products but displays products that have been set as “featured.” In this example, the shortcode is saying: Show 12 featured products in 4 columns.

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

Product

Show a single product by ID or SKU.

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

Products

Show multiple products by ID or SKU. Make note of the plural ‘products.’

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

Add to Cart

Show the price and add to cart button of a single product by ID.

[add_to_cart id="99"]

Add to Cart URL

Echo the URL on the add to cart button of a single product by ID.

[add_to_cart_url id="99"]

Product Category

Show multiple products in a category by slug.

Go to: WooCommerce > Products > Categories to find the slug column.

[product_category category="appliances"]

Product Categories

Display product categories loop

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

Set the parent parameter to 0 to only display top level categories. Set IDs to a comma separated list of category IDs to only show those.


Product Page

Show a full single product page by ID or SKU.

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

Sale Products

List all products on sale.

[sale_products per_page="12"]

Best-Selling Products

List best-selling products on sale.

[best_selling_products per_page="12"]

Related Products

List related products.

[related_products per_page="12"]

Top Rated Products

List top-rated products on sale.

[top_rated_products per_page="12"]

Product Attribute

List products with an attribute shortcode.

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

 

Was this article helpful?

Related Articles