All Collections
Omnisend Email Builder
Discount Item for WooCommerce
Discount Item for WooCommerce

Learn how to create unique discount codes in WooCommerce and use them in your Omnisend campaigns and automations

Ira avatar
Written by Ira
Updated this week

Omnisend offers various ways to provide discounts to your customers. Discount content block has an ultimate functionality, allowing you to generate unique discount codes for your WooCommerce store.

This article will show you how to set up unique discount code generation in your WooCommerce account and use them in your Omnisend campaigns and automations.

If your store is not on WooCommerce but on Shopify or BigCommerce, jump to the dedicated article.

If your store is on some other platform, check this article.

Didn’t find what you were looking for? Post a thread on the WordPress forum and support the community by getting the answers you need.


Before you begin

  • Unique codes will only work with unique discounts enabled in your WordPress admin. The process is described below.

  • If the Omnisend plugin isn't set to 'auto-update' in your WordPress admin, update it manually under the Plugins tab.

  • If you choose a static discount content block - you will need to type in the code manually. Unique codes are only populated in the Unique discount content block.

Setup process

To have auto-generated discounts for your WooCommerce store, you would need to go through a few simple steps to turn on unique code creation.

Step 1.

There are two ways to start the process: go to your WordPress admin and open your Omnisend plugin or begin by adding a Unique Discount block to your Omnisend email. A popup window will appear, providing instructions on how to turn on this feature.

Step 2.

Once in your WordPress Admin panel, you will see a banner prompting you to click the "Enable Unique discounts."

Step 3.

Once you click "Enable Unique discounts," a popup window will appear asking you to approve this action and to allow access to manage the coupons, products, customers, orders, and sales report. Click "Approve" to continue.

If you get an error message "Error: An error occurred in the request and at the time were unable to send the consumer data." please see the Troubleshooting section below.

Step 4.

After pressing the "Approve" button, a success message will appear in your WordPress Admin panel informing you that your site is connected to Omnisend now, meaning unique discount codes are enabled.

If you started by adding a discount block to your email, when you return to the Campaign Editor, you'll see a success banner meaning unique discount codes can now be used in your emails.

Unique discounts in Campaigns (single code per Campaign)

When you add the Unique Discount Content Block to your email campaign, a unique discount code will be generated for that campaign, ensuring that all campaign recipients receive the same discount code.

During the setup process, a placeholder of XXXX-XXXX-XXXX will be displayed, and the code will be automatically inserted from your store's admin once the campaign is sent.

Important! The email campaign test emails will still show the XXXX-XXXX-XXXX placeholder, as the discount code isn't generated when you send the test email.

In WooCommerce admin, the discount code will be displayed under Marketing → Coupons in the following way:

By clicking "edit" under the code, you will see general settings, usage restrictions, and usage limits for the generated code.

Unique discounts in Automations (single code per customer)

If you add the Discount content block to your automation, each email will include a custom, unique discount code. Therefore, each of the recipients will receive a unique discount code.

Note! You must follow the setup process described above to ensure you enable discount creation on the WordPress end. Otherwise, you will see the following popup banner.

During the setup, you will see the placeholder only, and the actual discount will be generated when the message is sent.

If you add the discount content block to each automation email, different codes will be generated. Although you won't be able to send a reminder for the same code, you may set the expiration date for the discount equal to the delay between messages.

Important! The automation test emails will still show the XXXX-XXXX-XXXX placeholder, as the discount code isn't generated when you send the test email.

Discount Content Block settings

The discount content block is available in the editor under the Content step.

You will need to open the Quick add menu and select one of the discount blocks → drag and drop it into your email if it's not added by default:

The static discount block has a code field where you must type in the code. Please note the code won't be generated automatically.

Unique discount codes will sync the codes generated in your WordPress admin automatically.

Once you add a Unique Discount block to the email, you can edit the code settings.

Under the Unique Discount tab, you will find the general settings where the content of the block and the discount conditions can be changed.

Discount type and Value type

The first option available in the menu allows you to choose the type of discount:

  • Cart discount - specify the percentage off or specific amount off (the amount will be set in your store's currency) and expiry period.

  • Free shipping - provides free shipping with a specific expiry date.

You can also apply the discount to all products or the minimum order price (the amount will be set in your store's currency).

Note! It's impossible to set discount conditions to be applicable to a specific category for now, but we're planning to add such an option in the upcoming updates.


Gmail Annotations are a feature specifically designed for promotional emails. They allow you to include additional information about your promotions. This additional information is displayed in the recipient's inbox, making your email more noticeable.

Here's what it looks like in your customers' inboxes.

The expiry period and Date format

After selecting the type and value of the discount, you can also provide an expiry period. The expiration period starts when the message with the discount is sent and ends at the end of the day + Expiration period, both in your Omnisend account time zone.

For example, if you send a message with a discount that expires in 1 day at 3:21 PM EDT on one day, the start time in EDT is set to 8:21 AM (3:21 in EET), and the end time is 4:59 PM (11:59 PM EET) on the next day.

In other words, the discount is valid for one day, plus hours left by the end of the other.


Button settings allow text, link, style, and button alignment editing. Note that the button link is the link your customers will be taken to after they click it. Per default, it's your store's homepage, but you can use any link you want.

Once you finalize editing the block, it will be auto-saved, so you can proceed with editing your email further 🚀

Discount codes are excellent for attracting new customers while demonstrating gratitude for loyal and long-term customers. Sharing discounts with your customers has never been easier. Simply add a discount content block to your email and make your email marketing relevant!


If you face any issues setting discount codes, please check the permalink settings in your WordPress admin. Default permalink will not work, so you would need to go to Settings → Permalinks and turn on "Post name":

Without this setting enabled, Omnisend won't be able to reach your WooCommerce Rest API to generate discount codes successfully.

If you get an error message "Error: An error occurred in the request and at the time we were unable to send the consumer data." please go to WooCommerce > Status > Tools:

Then scroll lower and click the "Verify database" button next to the "Verify base database tables" section:

Afterward, go to the Omnisend page and click "Enable Unique discounts" again.

If you still get an error, please contact your hosting provider and make sure that your store’sshops' WooCommerce Rest API is accessible from the outside. In particular, we expect that these endpoints are not blocked:

- [YOUR SHOP DOMAIN]/wp-json/wc/v3/settings
- [YOUR SHOP DOMAIN]/wp-json/wc/v3/coupons

Also, ensure that tools such as CloudFlare are not interfering with requests to these endpoints. If our integration can't access these endpoints, the Unique Discounts won’t we won't


Can the format of the auto-generated discount be changed?

The format of the code generated in the Discount Content block cannot be changed. Nevertheless, you can create your own code on your store and then insert it in your email as a static discount code.

Will I see the discount code in my WordPress admin?

Yes, the discount code will be created in your WordPress admin after sending the email.

Can I use multiple discount codes in a single email?

Ensure that only one unique discount code is generated per email; placing multiple unique codes will result in all of them using the same code based on the first block configuration.

To use different unique discount codes with different conditions, place them in separate emails.

Did this answer your question?