Shortcodes included with WooCommerce

WooCommerce has traditionally utilized shortcodes to easily add dynamic content and features to WordPress pages. With the evolution of WordPress towards the Gutenberg block-based editor, focus has shifted from shortcodes to more interactive and visually integrated blocks. While the block editor offers interactively customizable blocks and enhanced editing capabilities; you can still use the legacy shortcodes by adding them inside a shortcode block. 

We recognize many shops still lean heavily on shortcode functionality. The following table and linked documentation explain the available WooCommerce shortcodes in detail, with examples of how to use them.

Our WooCommerce blocks are now the easiest and most flexible way to display your products on posts and pages on your WooCommerce site. Read more about all the available WooCommerce blocks here.
Help us shape the Future at WooCommerce! Our team is always working to build tools that will help your business to succeed and feedback plays a vital role in that process. To make sure that our products are the best they can be, we regularly conduct research studies with our customers – and we’d love to add your voice to the conversation. Learn more here.

How to use Shortcodes

↑ Back to top

Where to use shortcodes

↑ Back to top

Shortcodes can be used on pages and posts in WordPress. If you are using the block editor, there is a shortcode block you can use to paste/add the shortcode.

Insert a shortcode via the shortcode block in the block editor.

If you are using the classic editor, you can paste the shortcode directly in the page or post content. 

Shortcode Attributes

↑ Back to top

Several shortcodes included in WooCommerce allow you to modify them to make them more specific or display a certain way. You can modify shortcodes by adding attributes (also called arguments/args) to the shortcode. For example, adding the attribute id to the [add_to_cart] short code will create an add-to-cart button for a product with a specific product id: [add_to_cart id=”99”] will add the add-to-cart button for the product in your shop with product id 99.

WooCommerce Shortcodes

↑ Back to top

The following table provides an overview of the available shortcodes included with WooCommerce along with a brief description and a link to the documentation specific to each shortcode and how to use it. Because WooCommerce has shifted toward block-based editing, we’ve also included links to block alternatives for each shortcode in the list where applicable: 

ShortcodeDescriptionLearn moreBlock Alternative
[woocommerce_cart]Show the cart page.WooCommerce Page Shortcodes: CartCart block
[woocommerce_checkout]Show the checkout page.WooCommerce Page Shortcodes: CheckoutCheckout Block
[woocommerce_my_account]Show the user account page.WooCommerce Page Shortcodes: My AccountNone
[woocommerce_order_tracking]Show the order tracking form. Has attributes.WooCommerce Page Shortcodes: Order Tracking FormNone
[product_page]Displays a full single product page by ID or SKUWooCommerce Page Shortcodes: Product PageNone
[products]Display products by specific parameters. Has attributes.Products ShortcodesProducts Block (and others*)
[product_category]Display products in a specified category. Has attributes.Product Category ShortcodesProducts by Category Block
[product_categories]Display product categories. Has attributes.Product Category ShortcodesNone
[add_to_cart]Show “add to cart” button for a product. Has attributes.Related Products, Add-to-Cart, and Notification Shortcodes: Add-to-CartNone
[add_to_cart_url]Get URL of “add to cart” for a product. Has attributes.Related Products, Add-to-Cart, and Notification Shortcodes: Add-to-Cart URLNone
[shop_messages]Show WooCommerce messages. Use when wanting to show shop messages on non-WooCommerce posts or pages.Related Products, Add-to-Cart, and Notification Shortcodes: Shop MessagesNone

* There are a variety of blocks to display products with different options such as the All Products block, Hand-Picked Products block, Products by Category Block, Products by Tag block, and more.

If you need help troubleshooting shortcodes, take a look at Troubleshooting Shortcodes and Code Snippets documentation for assistance with common problems related to shortcodes. 

Questions and Support

↑ Back to top

Do you still have questions and need assistance? 

This documentation is about the free, core WooCommerce plugin for which support is provided in our community forums on Searching there you’ll often find that your question has been asked and answered before.

If you haven’t created a account to use the forums, here’s how.

  • If you’re looking to extend the core functionality shown here, we recommend reviewing available extensions in the Woo Marketplace.
  • Need ongoing advanced support, or a customization built for WooCommerce? Hire a WooExpert agency.
  • Are you a developer building your own WooCommerce integration or extension? Check our Developer Resources.

If you weren’t able to find the information you need, please use the feedback thumbs below to let us know! 🙏