WooCommerce comes with several shortcodes which can be used to insert content inside posts and pages. The following shortcodes are inserted into pages upon installation and therefore shouldn’t need to be used anywhere else:
- [woocommerce_cart] – shows the cart page
- [woocommerce_checkout] – shows the checkout page
- [woocommerce_pay] – shows the checkout pay page
- [woocommerce_thankyou] – shows the order received page
- [woocommerce_order_tracking] – shows the order tracking form
- [woocommerce_my_account] – shows the user account page
- [woocommerce_edit_address] – shows the user account edit address page
- [woocommerce_view_order] – shows the user account view order page
- [woocommerce_lost_password] – shows the lost password page
You can add shortcodes to a post or page easily via the shortcode shortcut button in the post editor:
The following shortcodes can be used anywhere you want:
Recent products ↑ Back to Top
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 ↑ Back to Top
Works exactly the same as recent products but displays products which 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 ↑ Back to Top
Show a single product by ID or SKU.
[product id="99"] [product sku="FOO"]
*If the product isn’t showing, make sure it isn’t set to Hidden in the Catalog Visibility.
Products ↑ Back to Top
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"]
*If the product isn’t showing, make sure it isn’t set to Hidden in the Catalog Visibility.
Add to cart ↑ Back to Top
Show the price and add to cart button of a single product by ID.
[add_to_cart id="99"]
Add to cart URL ↑ Back to Top
Echo the URL on the add to cart button of a single product by ID.
[add_to_cart_url id="99"]
Product page ↑ Back to Top
Show a full single product page by ID or SKU.
[product_page id="99"] [product_page sku="FOO"]
Product category ↑ Back to Top
Show multiple products in a category by slug.
Args:
array( 'per_page' => '12', 'columns' => '4', 'orderby' => 'title', 'order' => 'asc', 'category' => '' )
[product_category category="foo"]
Product Categories ↑ Back to Top
Display product categories loop
Args:
array(
'number' => 'null',
'orderby' => 'name',
'order' => 'ASC',
'columns' => '4',
'hide_empty' => '1',
'parent' => '',
'ids' => ''
)
[product_categories number="12" parent="0"]
Set the parent paramater to 0 to only display top level categories. Set ids to a comma separated list of category ids to only show those.
Sale Products ↑ Back to Top
List all products on sale
Args:
array(
'per_page' => '12',
'columns' => '4',
'orderby' => 'title',
'order' => 'asc'
)
[sale_products per_page="12"]
Best Selling Products ↑ Back to Top
List best selling products on sale
Args:
array(
'per_page' => '12',
'columns' => '4'
)
[best_selling_products per_page="12"]
Top Rated Products ↑ Back to Top
List top rated products on sale
Args:
array(
'per_page' => '12',
'columns' => '4',
'orderby' => 'title',
'order' => 'asc'
)
[top_rated_products per_page="12"]


