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.

In this article, we'll show you how to set up unique discount codes generation in your WooCommerce account and use them in your Omnisend campaigns and automations.

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

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


Before you begin

Setup process

Unique discounts in Campaigns

Unique discounts in Automations

Discount Content Block settings



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, make sure to update it manually under the Plugins tab.

  • Unique codes for WooCommerce can be used in New Email Builder only. Classic builder does not support them.

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

Setup process

In order to have auto-generated discounts for your WooCommerce store, you would need to go through a few simple steps to enable unique codes creation.

Step 1.

There are two ways to start the process, you can go to your WordPress admin and open your Omnisend plugin or start by adding a Unique Discount block to your Omnisend email → a pop-up window will appear providing instructions on how to enable this feature.

Step 2.

Once you are in your WordPress Admin panel, you will see a banner prompting you to click the box "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 that your site is connected to Omnisend now, which means unique discount codes are now 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 single 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 be able to 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 need to follow the setup process described above to ensure you enabled discount creation on WordPress end. Otherwise, you will see the following pop up 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 of the automation emails, 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:

Static discount block has a code field where you need to type in the code. Please note, the code won't be generated automatically.

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

Once you add a Unique Discount block to the email, you will be able to 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 choose to apply the discount to all products or minimum order price (the amount will be set in your store’s currency).

Note! It's not possible 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.

Expiry period and Date format

After selecting the type and value of 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 the message with the 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 that left by the end of the other one.


Button settings allow editing the text, link, style and alignment of the button. Note, the button link is the link your customers will be taken to after they click the button. Per default, it's your website'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 an excellent approach to attract new customers, while also demonstrate gratitude to loyal and long-term customers. Sharing discounts with your customers has never been easier. In fact, simply add a discount content block to your email and make your email marketing relevant!


If you face any issues while setting up discount codes, please check permalink settings in your WordPress admin. Default permalink will not work, so you would need to go to Settings → Permalinks and enable “Post name”:

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

More info here:

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 go to WooCommerce > Status > Tools:

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

After this go back to the Omnisend page and click on “Enable Unique discounts” again.

If you still get an error please contact your hosting provider and make sure that your shops’ 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, make sure that tools such as CloudFlare are not interfering with requests to these endpoints. If our integration won't be able to access these endpoints, the Unique Discounts won’t work.


Is it possible to change the format of the auto-generated discount?

The format of the code generated in the Discount Content block cannot be changed. Nevertheless, you can create your own code on your store's admin 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 the email is sent.

Read other articles like this: Discount Content Block for Shopify and BigCommerce, Discount content block on different eCommerce platforms.

Did this answer your question?