WooCommerce - URL Coupons

Modified on Wed, 17 Feb 2021 at 03:08 PM

WooCommerce URL Coupons

The WooCommerce URL Coupons extension helps you create unique URLs that automatically apply a discount and products to the customer’s shopping cart. You can change where the customer is redirected after visiting the unique URL, and your URL coupons will still obey all coupon restrictions, such as usage restrictions.

Installation

  1. Download the extension from your WooCommerce dashboard
  2. Go to Plugins > Add New > Upload and select the ZIP file you just downloaded
  3. Click Install Now, and then Activate
  4. Go to WooCommerce > Settings > General and read the next section to learn how to setup and configure the plugin.

Setup and Configuration

While URL coupons doesn’t technically need settings to operate properly, it does add two options to the “General” settings that can streamline store management. When URL coupons is activated, you can adjust settings to hide other coupon methods from being used, which can sometimes help conversions as customers don’t leave your checkout to search for coupon codes. You can opt to hide the coupon fields on the cart page, checkout, or both:

Hide Coupon Fields

When these options are enabled the “Apply Coupon” options are hidden from customers on the respective pages, which can allow you to only use URL coupons for your store if you desire. Notice that the “Apply Coupon” field is missing to the left of “Update Cart” when using a URL coupon with these options enabled:

WooCommerce URL Coupons Field Hidden
URL Coupon Applied

Creating Coupons

When creating a new coupon code, or editing existing coupon codes, scroll to the bottom of the page to set the unique URL and other settings for the coupon. These do not have to be set unless you’d like to apply the coupon via URL:

WooCommerce URL Coupons new URL Coupon
Set a Unique URL and other Coupon Options
  • Unique URL – This is what’s added to the end of the store URL, which will create the URL that the customer can visit to have the discount applied. There is a live preview next to the text box that shows the full URL.
    Please read more about Unique URLs to learn about permalinks and expected behavior.
  • Products to Add to Cart (Optional) – Select which product(s) should be added to the cart when the URL is visited. If you want a variation of a product added to the cart, be sure to select the variation that has the proper attributes listed (e.g. don’t select “T-Shirt”, select “T-Shirt, small, black”). Only products that are valid for purchase will be added to the cart. For example, if a product is out of stock and you’ve disabled backorders for a product, that product will not be added to the cart when the unique URL is visited. Additionally, please note that at this time only one quantity of an item can be added to the cart via this method.
  • Page Redirect – Select which page the customer should be redirected to after visiting the unique URL. For example, if you have your unique URL set to /coupon/20off, you’d want to then redirect customers somewhere, like the shop or cart page, so they don’t see a 404 error.

    You can leave this blank if you don’t want to redirect customers, and instead want them land on a particular page (i.e., a post about a product) but still apply the coupon – just make sure have a trailing slash as described under Other Info. This is also helpful if you want to intentionally apply a coupon if a particular URL is visited – set the unique URL to the URL of the page/post/portfolio/etc, and don’t redirect the customer. For example, you could do this in an announcement post for a new product, and have a notice in the post that just by reading, customers have had a coupon automatically applied, and maybe even had a product added to the cart.

    If you leave the redirect blank to do this, just make sure the URL that you’re using for the coupon exists (i.e., the URL of a post, product, etc), otherwise the customer will see a 404 notice. For example, if I enter blog/newproduct/ for the unique URL since I want to give customers that read my post a coupon, and I leave the redirect blank, I need to also make sure that the post (or similar) definitely has the URL mystore.com/blog/newproduct/, or the customer will see a 404 error.
  • Defer Apply – Enable this option to “remember” the coupon in case the customer’s cart does not meet the requirements. Once the cart meets the requirements, the coupon will be applied. If disabled, the coupon will initially check for any requirements, and fail if they’re not present (won’t apply again once the requirements are met).

If a coupon has a URL assigned, you’ll also see this change when viewing all coupons, as a “URL Slug” column is added. This lets you easily see the URL for a coupon on your site.

WooCommerce URL Coupons Slug List
URL Coupon Slugs

Unique URLs

When creating the Unique URL, there are a few expected behaviors you should be aware of.

  • URLs are not case-sensitive. site.com/CoUpOn is the same as site.com/coupon
  • If you are using default permalinks (under Settings > Permalinks), you must include a ? before the URL. e.g. “?freeshipping”.
    url-coupons-default-permalinks
  • Note that if you use the URL of a product/post/page, any customer that views that product/page will have a coupon applied! You can use something like coupon/freeshipping to make sure your coupon URLs are unique.

You should also be aware that a trailing slash on a URL makes a difference in how the URL coupon behaves. For example, a unique URL of mystore.com/coupon/thanks will behave differently than a coupon with the URL mystore.com/coupon/thanks/.

No trailing slash:

Leave your coupons without a trailing slash if you’d like to use this as a “starting point” for your URL coupon. This is extremely helpful if you’d like to personalize URL coupons for customers.

Let’s say I create a coupon code called “thanks” and my Unique URL is set to coupon/thanks. When a custom visits mystore.com/coupon/thanks, the coupon code is applied.

However, I can also personalize this URL, as any URL that starts this way will also have the coupon applied. I can give out URLs like mystore.com/coupon/thanks-john or mystore.com/coupon/thanksjane, and these will act the same way as mystore.com/coupon/thanks and all use the same coupon code.

With a trailing slash:

If you don’t want to allow a “generic” URL like this, then you can add a trailing slash to the end of your unique URL. Instead of creating a coupon with Unique URL coupon/thanks, we’ll add a trailing slash: coupon/thanks/.

Now this coupon will only be applied if the customer visits mystore.com/coupon/thanks/. The URL mystore.com/coupon/thanks will not work, nor will any URLs that begin this way, such as mystore.com/coupon/thanksjane/.

Use the trailing slash method if you want to allow one and only one URL to apply the coupon.

Importing URL Coupons

As of version 2.4.0+, URL Coupons has support for the Customer / Coupon / Order CSV Import Suite plugin. This allows you to import new coupons with URL settings, or update existing coupons via a merge import.

When you have URL Coupons 2.4.0+ and Customer / Coupon / Order CSV Import 3.1.0+ active at the same time, you’ll automatically have URL Coupons options available for your import column mapping.

WooCommerce URL Coupons: CSV Import column options
URL Coupons columns

There are 5 new fields for each coupon you can import:

COLUMN HEADERVALUE
url_coupons_unique_urlthe slug for the coupon URL, ie coupon/thanks/
url_coupons_redirect_pagethe ID of the content to which the coupon should redirect. This can be a product, page, or taxonomy ID. For example, if I want to redirect to the cart page, I’ll use the WordPress ID for that page. If I want to redirect to the “Music” product category archive, I can also use the term ID for that category. If this is anything but a page, you must set the “redirect type” column as well.
url_coupons_redirect_page_typethe post or taxonomy type for the coupon redirect. This defaults to page, but you can use productproduct_catproduct_tag or other content types.
url_coupons_product_idsA comma-separated list of product IDs (not SKUs) that should be added to the cart when this coupon is used.
url_coupons_defer_apply“yes” or “no” – yes if the coupon should defer applying until the cart meets requirements
WooCommerce URL Coupons: Map CSV Import Columns
Map Columns

Once you’ve mapped the columns for your import, you can run your dry and live imports, and this will add or update coupon data with URL coupons settings.

WooCommerce URL Coupons: Mapped import data

Troubleshooting

Having trouble? Check if these pointers help you solve your problem before posting a support request:

  • If you’re not seeing the “Coupon Code Applied” message, make sure you are redirecting to a page that shows messages. Try the Shop or Cart page.
  • If the product you’ve selected to be added to the cart is not being added, ensure that you are not restricting it either by the “Exclude Products” section in coupon setup or the edit product page (or you can enable the Defer Apply option).

    Also ensure that, if the product is variable, that you’ve selected the correct variation and not the parent product.

  • If it seems like your coupons don’t work, or you’re not sure they’re working as expected, check your permalinks and URL setup as described here.
  • If it seems like your coupons break after one use or the discount is not applying, check out this FAQ entry on caching.

Frequently Asked Questions


Q: Why does it seem like my coupon doesn’t apply or breaks after one use?
A: This is most likely a caching issue with your host. Some hosts, such as WP Engine, cache these URLs and this breaks the coupon functionality. If you have an issue with this with either your host or a caching plugin on your site, we recommend that you use a unique prefix for all coupons, such as coupon/, then ask your host or set your plugin to not cache any requests with that prefix.

For example, instead of using the URL mystore.com/freeshipping for a free shipping coupon, we would replace it with mystore.com/coupon/freeshipping by entering coupon/freeshipping during coupon setup. If your host stops caching any URL that starts with coupon/, this will work seamlessly.

Other Information

  • You may use a unique URL that already exists (say, a product page URL), but you must include a trailing slash for the unique URL (e.g. use /product/url-coupons/ and not /product/url-coupons) as WordPress will add a trailing slash by default. Leave the redirect blank to have the coupon applied and allow the page to load normally.
  • You may use any of the built-in pages as the unique URL (e.g. /shop/ or /cart/) but the coupon code will be applied by everyone who visits that URL, so use this with caution.
  • To ensure that the customer sees the “Coupon Code Applied” message, you must redirect to a page that displays messages by default. The Shop page will display messages, as will the cart and checkout page if the customer has a product added to their cart (or you’ve set up the coupon to add the product to their cart).

WooCommerce URL coupons also supports the Smart Coupons extension CSV coupon export. When selecting coupons to export from the Marketing > Coupons page, unique URL coupons will be included in the CSV file.

Plugin Tutorials

Want to read about a couple different use cases or tutorials with this plugin? Here are some helpful posts:

Questions & Support

Have a question before you buy? Please fill out this pre-sales form.

Already purchased and need some assistance? Get in touch with support via the help desk.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article