WooCommerce has traditionally utilized shortcodes to add dynamic content and features to WordPress pages. With WordPress’s evolution toward the Gutenberg block-based editor, the focus has shifted from shortcodes to more interactive and visually integrated blocks.
While the block editor offers interactively customizable blocks and enhanced editing capabilities, we recognize many stores still lean heavily on shortcodes. You can use legacy shortcodes inside a shortcode block.
Note: WooCommerce blocks are the simplest, most flexible way to display products on posts and pages. Learn more about WooCommerce blocks.
Help shape the future of 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 help make sure our products are the best they can be, we regularly conduct customer research studies — and we’d love you to add your voice to the conversation. Learn more about customer research studies.
How to use shortcodes
↑ Back to topWhere to use shortcodes
↑ Back to topShortcodes can be used on WordPress posts and pages. If you are using the block editor, you can paste the shortcode into a shortcode block.
If you are using the Classic Editor, you can paste the shortcode directly into the page or post content.
Shortcode attributes
↑ Back to topSome shortcodes allow you to modify them to make them more specific or display content in a certain way. You can modify shortcodes by adding attributes (AKA arguments or args) to them.
For example, adding the attribute id
to the [add_to_cart]
shortcode will create an add-to-cart button for a specific product. [add_to_cart id=”99”]
displays an add-to-cart button for the product with an ID of 99
in your shop.
WooCommerce shortcodes
↑ Back to topThe table below provides an overview of the shortcodes available in WooCommerce. Each item includes a brief description and a link to shortcode-specific documentation.
As WooCommerce has moved to block-based store editing, we’ve also included links to block alternatives for each shortcode (where applicable).
Shortcode | Description | Learn more | Block alternative |
[woocommerce_cart] | Displays the cart page. | Cart shortcode | Cart block |
[woocommerce_checkout] | Displays the checkout page. | Checkout shortcode | Checkout block |
[woocommerce_my_account] | Displays the user account page. | My account shortcode | None yet |
[woocommerce_order_tracking] | Displays the order tracking form; has attributes. | Order tracking shortcode | None |
[product_page] | Displays a full single product page by ID or SKU. | Product page shortcode | Custom product page templates can be made using the store editor |
[products] | Displays products by specific parameters; has attributes. | Product shortcodes | Product collection block (and others*) |
[product_category] | Displays products in a specified category; has attributes. | Product category shortcodes | Product collection block |
[product_categories] | Displays product categories; has attributes. | Product category shortcodes | None yet |
[add_to_cart] | Displays an add-to-cart button for a product; has attributes. | Add-to-cart shortcode | Available on single product page templates |
[add_to_cart_url] | Gets the URL of an add-to-cart button for a product; has attributes. | Add-to-cart URL shortcode | None |
[shop_messages] | Displays shop messages on non-WooCommerce posts or pages. | Shop message shortcode | Store notices block |
Note: A variety of blocks display products with different options, including the all products block, hand-picked products block, products by category block, products by tag block, and more.
These are being deprecated in favor of the more robust and versatile product collection block.
If you need help, please review troubleshooting shortcodes and code snippets for assistance with common shortcode-related problems.
Questions and support
↑ Back to topDo 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 WordPress.org. By searching this forum, you’ll often find that your question has been asked and answered before.
If you haven’t created a WordPress.org 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 WooCommerce Marketplace.
- Need ongoing advanced support or a customization built for WooCommerce? Hire a Woo Agency Partner.
- 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.