How to Dynamically Create a WooCommerce Coupon Code

Eric Berkhinfand

If there’s something that all people have in common, it’s that they like a bargain. If you could find me a person who would rather pay full price over getting a discount, I’d be very impressed. An eCommerce store owner that can take advantage of this fact is well on their way to an early retirement. Luckily, in the WooCommerce world, we have a handy tool that we can use for this exact purpose; WooCommerce coupon codes.

I’m going to start off this eCommerce post, with a not so eCommerce example, but hear me out... Picture a fisherman who gets up early in the morning to beat the morning rush at the pier. He throws in his line in the water with some bait, and waits, and waits, and waits. To his dismay, he doesn’t even get one bite. But luckily for him (and unluckily for the fish), he has a trick up his sleeve, fishing berley. Berley is a mixture of food that a fisherman throws into the water to lure fish in. Our fisherman friend throws some burley in, and within 10 minutes he catches a big fish for dinner!

So now you’re wondering why on earth I just spent a whole paragraph teaching you how to fish. I can tell you now, it’s not because I’m so passionate about fishing (although I do enjoy it from time-to-time). It's because as eCommerce store owners we can learn a valuable lesson from the fisherman. If we think of the fishing rod as our store and the fish as our customers, then what is the berley? The berley is our coupon codes. If we use coupon codes in a strategic way, they can effectively lure customers to our store.

Think back to the fisherman. He uses the burley to lure the fish in, but once the fish is on the hook, it’s up to him to reel it in successfully. Similarly, you can use coupon codes to bring customers to your site, but you need to have a good product and customer experience to ultimately make the sale.

There are currently hundreds of blog posts on the internet explaining how to create a WooCommerce coupon code. Today we are going to go further than those posts, and look at how you can create unique, targeted, and dynamic coupon codes, and automatically email them to potential and existing customers.

But just so everyone’s on the same page, let’s quickly cover the basics.

  1. How to create a coupon with WooCommerce

  2. WooCommerce coupon code strategy: Generic or unique

  3. The dynamic unique coupon code

  4. Conclusion

How to create a coupon with WooCommerce

To create a WooCommerce coupon code, head to your WordPress admin, click WooCommerce → Coupons and click Add coupon. You can now choose the name of your coupon and give it an optional description.

woocommerce coupon code woocommerce coupon code

You can also choose which type of discount you want to apply. There are a number of options:

  • Percentage discount – A percentage discount for the entire cart. 

  • Fixed cart discount – A fixed total discount for the entire cart. 

  • Fixed product discount – A fixed total discount for selected products only. 

  • WooCommerce Subscriptions: Sign Up Fee Discount.

  • WooCommerce Subscriptions: Sign Up Fee % Discount.

  • WooCommerce Subscriptions: Recurring Product Discount.

  • WooCommerce Subscriptions: Recurring Product % Discount.

From here, there are many customization options to help you create the perfect WooCommerce coupon code for your use case. I’d refer you to the WooCommerce docs if you need a more detailed walkthrough on all the customization options. I’m going to use our precious time to talk coupon code strategy.

WooCommerce coupon code strategy: Generic or unique 

While the default method for creating coupons in WooCommerce is fine for when you are just starting out, as you begin to grow, it is going to cause some major issues. 

When you create a coupon code the default way, you create what is known as a generic coupon. These are the ones you will find scattered around the internet that anyone can use. They often have names like 100PERCENTOFF and SPRINGSALE. The advantage of generic coupon codes is that they are easy and quick to create (like we just saw). You just need to create it once, and all your customers and other potential customers can use the same code. However, the main issue is that it’s not a very targeted marketing approach. You might have intended for only 1 segment of customers to get this code, but once it’s live on the internet, anyone can use it. And if you haven't set a usage limit, you may find more people using it than expected.

That’s where the unique coupon code comes in. Rather than creating one generic coupon code for everyone, a unique coupon code is exactly what its name suggests, it’s unique to each customer.

You might want to offer a coupon code to customers that haven’t purchased in over a year to entice them to make another purchase. This is a case where a generic coupon code isn’t going to work so well, as your customer can then send that coupon code to friends. They could even post it on a coupon sharing site, unintentionally costing you money. A better option would be to send each customer their own unique coupon code that can only be used once. 

While this is a powerful marketing strategy, it also suffers from a very big limitation. What would happen if you had 1000 customers that hadn’t purchased in a year? You would need to create a code manually for each customer, and then email it to them - a very time-consuming exercise. As you can see, this doesn’t scale well.

What if there was a solution that combined the convenience of the generic coupon code, with the effectiveness of the unique coupon code? Well luckily for you, there is. The dynamic unique coupon code.

The dynamic unique coupon code

A dynamic unique coupon code is one that is automatically created. And if you are using some sophisticated software, it could even be automatically emailed to your target customers. So think back to the example above of sending a unique coupon code to 1000 different customers. With software that can create dynamic coupon codes and automatically email them, this is no longer a problem.

How to create a dynamic WooCommerce coupon code

This is what I would call, expert-level coupon code use. Using an app like Metorik, you can easily create dynamic unique coupon codes and increase your sales significantly. The great thing is that Metorik will automatically create the coupon codes within your WooCommerce admin, and then add them automatically email them to your customers (no other plugins needed).

Let’s look at two different dynamic coupon code use cases.

Use Case One: Creating a dynamic coupon code for customers that haven’t made a purchase in over a year.

Using Metorik’s powerful segmenting system, we can create a filter to target our specific customer subset. Let’s set a filter so that an email is sent to a customer when they last ordered over 12 months ago. We have 537 customers that currently match the filter. That’s 537 potential new sales:

I’m going to now compose an email that customers who match the filter are going to receive. Here we can dynamically add variables like the customer’s first name and the unique coupon code.

We can also click the add discount button to include our dynamic unique coupon code:

metorik add coupon code metorik add coupon code

From here we can configure the coupon code with the standard WooCommerce options we spoke about earlier in the post:

metorik coupon configuration metorik coupon configuration

And our email is now configured are ready to deploy:

metorik engage email preview metorik engage email preview

Once the automation has been activated, customers that meet the filter we set will be greeted with the email we crafted, and their own unique coupon code:

metorik customer email with coupon code metorik customer email with coupon code

The great thing is that when they click the shop now button, they are automatically taken to the store, and the coupon is automatically applied. You can see the coupon code in the URL:

Use Case Two: Creating a dynamic coupon code for customers that have abandoned their cart

These are the potential customers that almost completed their purchase, but for some reason, decided not to. Metorik can help you track their cart, and if they abandon it, dynamically send them an email with a unique coupon. Using a targeted and personal approach like this can help turn an abandoned cart into a recovered cart.

Metorik already has 3 abandoned cart emails out of the box that you can choose to activate:

metorik abandoned cart recovery emails metorik abandoned cart recovery emails

I’m going to set up Email #1. From the audience tab, we can choose when the abandoned cart email should be sent? Let’s keep it at the default of 1 hour:

metorik abandoned cart email configuration metorik abandoned cart email configuration

Similar to our last automation, we can configure our message and add a dynamic unique coupon code by clicking the add discount button:

metorik abandoned cart email preview metorik abandoned cart email preview

Now all customers who abandon their cart will receive an email from us with their own unique coupon code, and hopefully, return to our store to complete their purchase:

metorik abandoned cart email with coupon code metorik abandoned cart email with coupon code

You can completely customize the abandoned cart email sequence based on the purchasing experience you want your customers to have. Instead of just sending one email with the coupon code straight away, you could create a sequence that sends 3 emails and only includes the coupon code in the 3rd email.


I hope today you have learned a bit more about WooCommerce Coupon Codes (and fishing). While generic coupon codes have their purpose, specifically in large marketing campaigns and sales, dynamic unique coupon codes can be a valuable tool for adding a personal touch to your customers’ purchasing experience. If implemented well, this approach can dramatically improve sales and build your brand.

Want to try Metorik today?

We're so sure you'll love Metorik that you can start right now, for free, without a credit card - and use the entire product for 30 days.