1. Home
  2. Knowledge Base
  3. Advanced Coupons
  4. URL Coupons
  5. How to apply a coupon with a URL (URL coupons)

How to apply a coupon with a URL (URL coupons)

Sending a coupon code and hoping shoppers type it in loses sales. A URL coupon applies the discount for them: they click a link, and the coupon lands in their cart. This guide covers creating the link, what happens when the coupon has a cart condition, applying coupons through a query string, and how the links behave on a multilingual store.

Prerequisites

  • WooCommerce installed and active.
  • Advanced Coupons for WooCommerce installed and active.
  • At least one coupon created.
  • Advanced Coupons Premium, only if you want to use the Defer apply option.

Create and share a coupon URL

Every coupon can have its own link that applies the coupon when the customer clicks it. Use it in email marketing, behind a button, or in a live chat message.

  1. Go to Coupons > All Coupons and open the coupon, or create a new one.
  2. Click the URL Coupons tab.
  3. Tick Enable Coupon URL.
  4. Click Update to save the coupon, or Publish if it’s a new coupon.
  5. Copy the link in the Coupon URL field.
  6. Share the link with your customers.
URL Coupon setting

When a customer clicks the link, the coupon applies and they go to the cart page. A notice there confirms that the coupon is applied. To send them to a different page, enter its full address in Redirect To URL.

Default success message

To change the notice, enter your own text in Custom Success Message on the same tab. For example, add an instruction for the customer.

Custom success message

Using a coupon URL with a cart condition

Non-qualifying message

If the coupon has a cart condition (for example, a minimum cart subtotal of $50), the coupon URL doesn’t apply the coupon while the cart is empty. The coupon stays invalid until the cart meets the condition.

The error notice when a customer uses a coupon URL before the cart condition is met

This can confuse customers. To help, change the non-qualifying message of the cart conditions so it describes the requirement clearly. For example:

Customized the non-qualifying message

When a customer clicks the coupon URL before they meet the condition, they see your message instead:

Your customer then knows why the coupon isn’t applied and what to do to qualify.

Defer apply option (Premium)

By default, when a customer clicks the coupon URL before their cart meets the condition, the coupon isn’t applied later when the cart does meet it. The customer needs to click the coupon URL again or enter the coupon code.

With Advanced Coupons Premium, tick Defer apply on the URL Coupons tab. The coupon is then saved in the customer’s session and applies on its own once the cart meets the condition. See How to use the Defer apply option for URL coupons.

Redirect back to origin

Tick Redirect back to origin to send the customer back to the page where they clicked the coupon URL, instead of the cart page or the page in Redirect To URL. Use this when you place a coupon URL as a button in a blog post or landing page, and you want the customer to stay on that page after the coupon applies.

This setting only works when the click comes from a page on your own site. If the browser sends no referrer, or the referrer is another site (for example, an email app that strips referrer data), the customer goes to the Redirect To URL page instead. If that field is empty, they go to the page in Redirect to URL after applying coupon under Coupons > Settings > URL Coupons, or to the cart page if that is empty too.

The URL Coupons tab showing the Redirect back to origin checkbox

Apply coupons with a query string

You can also apply a coupon by adding ?coupon=COUPONCODE to the address of any page on your store. To turn this on:

  1. Go to Coupons > Settings > URL Coupons.
  2. Under Apply coupons via query string, tick Enable applying coupon via query string.
  3. In Redirect after applying coupon via query string, choose where the customer goes after the coupon applies: Stay on the same page (the default), Redirect to cart, or Redirect to checkout.

The settings save automatically.

Then add the query string to any page link, for example a product page:

http://example.com/some-product/?coupon=mycouponname

When a customer opens the link, the coupon applies and a notice confirms it. With Stay on the same page, the customer stays on the page they opened, and the coupon code is removed from the address.

Coupon URLs on a multilingual store

If you run WPML, the coupon URL is built for the language the shopper is browsing in. A shopper on the Bengali version of your store gets a link like example.com/bn/coupon/mycouponcode/, not the default-language one.

Advanced Coupons 4.7.1 fixed a case where these links were built wrongly. If WPML was set to Use directory for default language, a secondary-language coupon URL picked up both directories and came out as example.com/en/bn/coupon/mycouponcode/. That link did not resolve. From 4.7.1 the default-language directory is dropped, so the link is example.com/bn/coupon/mycouponcode/ as expected.

If you’re on an older version and see a doubled language directory in your coupon links, update the plugin. Nothing needs to be reconfigured afterwards.

Changing the coupon URL yourself

Developers can change the generated link with the acfw_coupon_url filter, which receives the coupon URL and the coupon object.

Troubleshooting

The coupon URL goes to a 404 page

Go to Settings > Permalinks, make sure Post name is selected, and click Save Changes. If the link still shows a 404 page, clear your cache and test again. See How to fix a URL coupon going to a 404 page.

The customer goes to the cart instead of the Redirect To URL page

Check that the address in Redirect To URL is a full address that starts with http:// or https://. If the address isn’t valid, Advanced Coupons sends the customer to the cart page instead. See How to fix a URL coupon redirecting to the cart instead of your Redirect To URL setting.

The coupon doesn’t apply for customers who aren’t logged in

Exclude links that contain your coupon URL prefix (/coupon/ by default) from your caching plugin, or ask your host to exclude them from server caching. A cached copy of the link skips the step that applies the coupon. See How to fix the URL coupon not applying for non-logged-in users.

Frequently asked questions

How long does a URL coupon stay applied?

When a customer clicks a coupon URL, the coupon is added to their WooCommerce cart session. Advanced Coupons doesn’t keep a separate record of the click, so the coupon stays applied for as long as WooCommerce keeps that session.

By default, WooCommerce keeps a session for about 2 days for guests and about 7 days for logged-in customers. Other plugins or custom code can change this.

Once the session ends, the coupon is removed from the cart, and a later purchase isn’t linked to the coupon URL. The customer needs to click the link again or enter the coupon code. Logged-in customers get their saved cart items back, but not the coupon.

Coupons that use the Defer apply option (Premium) are held in the same session, so the same time limit applies.

Does a URL coupon work for guests?

Yes. Customers don’t need an account or to be logged in. The coupon applies to their cart session the same way. If it works for logged-in customers but not for guests, a cache is usually serving an old copy of the link. See How to fix the URL coupon not applying for non-logged-in users.

Need help?

If you have a question or run into any issues, we’re here to help.

Was this article helpful?

Related Articles

Complete Your Purchase