The Coupon Shortcodes extension allows you to render coupon information and show content based on the validity of coupons.
Customers can be motivated to proceed with their purchase, offering them to use specific coupons when the contents in the cart qualify for it, or by offering them to purchase additional items so they can use a coupon.
It provides the following conditional shortcodes that allow enclosing content which is shown if coupons are applied, valid or not valid.
It also provides shortcodes that allow to render the coupon code, its description and an automatic description of the discount:
A coupon enumerator shortcode allows to list all or a set of coupons, to show their code, description or discount information.
Please refer to the plugin’s documentation for detailed descriptions.
Show a text when a coupon can be used (active) – this is useful to show promotional info while coupons can be used, as active means that the coupon has not reached its expiration date nor exceeded its usage limits:
Happy Easter!
Use the coupon code to hop away with a great discount.
This is an example of a text shown when a promotion is over:
Our special discount sale has ended. Come back often to see more!
Showing a coupon when the cart contents qualify for a coupon to be applied:
You qualify for a discount!
Use the coupon code to take advantage of this great discount.
Showing a coupon that is not valid for the current cart and motivating to add items:
If you purchase 5 Widgets, you can use the coupon to get 25% off your purchase!
Show information about three random coupons, including the coupon code, its description and discount info together on each entry.
Show a single random coupon code.
WooCommerce comes with several shortcodes that can be used to insert content inside posts and pages.
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.
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 the shortcode in.
If you are using the classic editor, you can paste the shortcode on the page or post.
Several of the shortcodes below will mention “Args”. These are ways to make the shortcode more specific. For example, by adding id="99" to the shortcode, it will create an add-to-cart button for the product with ID 99.
WooCommerce cannot function properly without the first three shortcodes being somewhere on your site.
Note: You can now test the new cart and checkout blocks that are available in the WooCommerce Blocks plugin!
These shortcodes will be added to pages automatically via our onboarding wizard and do not need to be used manually.
Used on the cart page, the cart shortcode displays cart content and interface for coupon codes and other cart bits and pieces.
Args: none
Used on the checkout page, the checkout shortcode displays the checkout process.
Args: none
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.)
Args:
Current user argument is automatically set using get_user_by( 'id', get_current_user_id() ).
Lets a user see the status of an order by entering their order details.
Args: none

The products shortcode is one of our most robust shortcodes, which can replace various other strings used in earlier versions of WooCommerce.
It allows you to display products by post ID, SKU, categories, attributes, with support for pagination, random sorting, and product tags, replacing the need for multiple shortcodes used in older versions of WooCommerce.
The following attributes are available to use in conjunction with the products shortcode. They have been split into sections for primary function for ease of navigation.
Display Product Attributes:
limit – The number of products to display. Defaults to -1 (display all).
columns – The number of columns to display. Defaults to 4.
paginate – Toggles pagination on. Use in conjunction with limit. Defaults to false.
orderby – Sorts the products displayed. Options include:
date – The date the product was published.
id – The post ID of the product.
menu_order – The menu order, if set.
popularity – The number of purchases.
rand – Randomly order products on page load.
rating – The average product rating.
title – The product title (default).
skus – Comma-separated list of product SKUs.
category – Comma-separated list of category slugs.
tag – Comma-separated list of tag slugs.
order – ASC or DESC.
class – Adds a CSS class for styling.
on_sale – Show products on sale.
best_selling – Show best-selling products.
top_rated – Show top-rated products.
Content Product Attributes:
attribute – Retrieves products using a specific attribute slug.
terms – List of attribute terms.
terms_operator – Operators: AND, IN (default), NOT IN.
tag_operator – Operators: AND, IN (default), NOT IN.
visibility – Options:
visible – On shop and search (default).
catalog – Shop only.
search – Search only.
hidden – Hidden from shop/search.
featured – Marked as Featured Products.
category – Retrieves products using a category slug.
tag – Retrieves products using a tag slug.
cat_operator – Category term operator: AND, IN (default), NOT IN.