Home > Docs > Smart Coupons for WooCommerce > How to Auto-Apply Coupons in the Cart Using URL Coupons and Shortcodes

How to Auto-Apply Coupons in the Cart Using URL Coupons and Shortcodes

Last updated on April 24, 2026

To auto-apply a coupon in WooCommerce, append ?wt_coupon=COUPONCODE to your site URL (for example, https://yoursite.com/cart/?wt_coupon=flat30). When a customer visits the link, the coupon is automatically applied to the cart, provided all usage conditions are met.

URL Coupons is a feature of the Smart Coupons for WooCommerce plugin that lets you pass a coupon code via a URL and apply it automatically to any page while preserving usage restrictions. To implement the URL Coupon, simply use the following syntax:

<site_url>/?wt_coupon=<coupon_code>

For example, to implement a URL coupon in the cart page of a website www.webtoffee.com with the coupon code FLAT30, specify the URL coupon in the following format:

https://www.webtoffee.com/cart/?wt_coupon=flat30

Automate Cart Discounts with URL Coupons and Smart coupon shortcodes

As mentioned above, there are multiple ways to embed a coupon that can automatically apply a cart discount. Consider an example of linking the URL with the coupon shortcode.

  • Create a post where you want to display the redirecting text/image/any other element. In this case, the coupon’s shortcode.
  • Enter the element(shortcode) on the page.
  • Create a hyperlink to the element and enter the site URL in the given format(https://www.webtoffee.com/cart/?wt_coupon=flat30).
  • Finally, click on Publish/Update.
Smart Coupons for WooCommerce - URL Coupons with shortcode demo
Smart Coupons for WooCommerce – URL Coupons with shortcode demo

Now you can simply click on the coupon element on the published page to get redirected to the cart, where the coupon will automatically apply.

Smart Coupons for WooCommerce - URL Coupons with shortcode demo
Smart Coupons for WooCommerce – URL Coupons with shortcode demo

Alternatively, you can use images, text, or any other element to automate discounts with URL coupons.

If you want to enhance the functionalities of your URL-based coupons, like automatically adding products to the cart upon coupon application, generating a QR code for your coupon, and personalizing your URL coupons with your own branding and logo, explore our dedicated URL Coupons for WooCommerce plugin.