Omnisend's Unique Discount Block can auto-generate unique discount codes for your WooCommerce store.
In this article, you’ll learn how to set up unique discount code generation in your WooCommerce account and use it in your Omnisend campaigns and automations.
Using a different platform?
Shopify or BigCommerce: Refer to the dedicated article for your platform.
Other ecommerce platforms: Check the relevant guide.
💡 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
Connecting the Omnisend plugin to WooCommerce does not automatically enable unique discount codes. You must complete the one-time setup below to allow Omnisend to generate codes in WooCommerce.
If the Omnisend plugin isn't set to auto-update in your WordPress admin, update it manually under the Plugins tab.
Unique vs. Static Discount Blocks
Unique Discount Block: Auto-generates a new code for each recipient (requires setup). Use this for automated, single-use codes.
To use this option, follow the setup steps below.
Static Discount Block: You manually type in a code you've already created in WooCommerce. The code won't be generated automatically. Use this for reusable codes (e.g., "
WELCOME10") or codes with product/category restrictions.
Enable Unique Discounts
To enable auto-generated discounts for your WooCommerce store, follow the steps below to activate unique discount code creation.
Step 1. You can start in one of two ways:
Go to your WordPress admin panel and open the Omnisend plugin, or
Add a Unique Discount block to your Omnisend email.
A pop-up window will appear with instructions on how to enable this feature.
Step 2. In your WordPress admin panel, locate the banner prompting you to click Enable unique discounts and click it.
Step 3. After clicking Enable unique discounts, a pop-up window will ask you to approve access to manage coupons, products, customers, orders, and sales reports. Click Approve to continue.
If you receive the following error message: "Error: An error occurred in the request, and at the time, we were unable to send the consumer data," refer to the Troubleshooting section below.
Step 4. After clicking Approve, a success message will appear in your WordPress admin panel confirming that your site is connected to Omnisend. This means unique discount codes are now enabled.
If you started by adding a Discount block to your email, return to the Campaign Editor. You will see a success banner confirming that unique discount codes are ready to use.
💡 After setup:
To verify that discount codes are being generated, go to WooCommerce → Marketing → Coupons after sending your campaign or automation.
Add Discount to Email Campaigns
To add a discount to your email campaign, open the Email Campaign Editor → Drag the Unique Discount block into your email layout → Configure the discount type, value, and expiry.
When you add the Unique Discount content block to your email campaign, a unique discount code is generated for that campaign. All recipients of the campaign will receive the same discount code.
During setup, a placeholder (XXXX-XXXX-XXXX) is displayed in the editor. The actual discount code is automatically generated and inserted from your WooCommerce admin once the campaign is sent.
Important: Test emails will continue to display the XXXX-XXXX-XXXX placeholder. The discount code is not generated when sending a test email.
In your WooCommerce admin panel, you can find the generated discount code under Marketing → Coupons.
Click Edit under the coupon code to view and manage its:
General settings;
Usage restrictions;
Usage limits.
Add Discount to Automation
You can add a unique discount code to both email and SMS messages within your automation workflow.
Note: When you add the Unique Discount block to an automation email, Omnisend generates one unique code per contact per email. This means each recipient receives their own individual discount code.
Add Discount to an Email in Automation
Open your Automation workflow → Click the Email step where you want to add the discount → Select Edit content → Drag and drop the Unique Discount block into your email layout.
You can configure the discount settings on the right-hand menu.
Note: Automation test emails will continue to display the XXXX-XXXX-XXXX placeholder, as discount codes are not generated when sending test messages.
Add Discount to an SMS in Automation
Open your Automation workflow → Click the SMS step → In the right-hand menu, add the Unique Discount tag to your message content.
You can configure the discount settings as needed.
Reusing the Same Discount Code in a Workflow
If you add the Unique Discount block to multiple messages within the same automation, different codes will be generated by default.
To use the same code across multiple email and SMS messages in the workflow, enable Reuse unique discount code in this workflow.
When enabled, the same discount code will be applied to the contact across multiple automation messages (both email and SMS), keeping your offer consistent.
Important Notes:
If the coupon expiration date is shorter than the delay between automation messages, Omnisend will check whether the reusable discount code is still valid before sending the next message.
If the code has expired, a new one will be generated automatically, even if the reuse setting is enabled, to prevent sending expired discounts.
Configure Discount Settings
Once you add the Unique Discount block to your message, open the Unique Discount tab to configure its settings.
Discount Type and Value
The first option allows you to select the discount type:
Cart discount – Choose a percentage or a fixed amount (set in your store’s currency) and define the expiration period.
Free shipping – Provide free shipping with a defined expiration date.
You can also apply the discount to all products, or set a minimum order value (in your store’s currency).
Note: It is currently not possible to restrict discount conditions to a specific product category. This option is planned for future updates.
You may also choose to exclude items on sale, ensuring the coupon applies only to non-sale products.
Annotation
Gmail Annotations are designed for promotional emails and allow you to display additional promotion details directly in the recipient’s inbox, helping your email stand out.
When enabled, promotional information appears directly in Gmail’s inbox preview.
Usage
In Campaigns, you can manage how discount codes are redeemed:
Unlimited times – Set a maximum number of times the discount code can be used overall
Only Once – Restrict how many times the same customer can use the discount.
Note: Usage settings are available for email campaigns only since all recipients receive the same code.
Expiry Period & Date Format
After selecting the discount type and value, you can define an expiration period. The expiration period:
Starts when the message is sent.
Ends at 11:59 PM (end of day) after the selected number of days.
Follows your Omnisend account time zone.
For example, If you send a discount set to expire in 1 day, the coupon will remain valid until 11:59 PM (account time zone) on the following day.
In other words, the discount is valid for the selected number of days plus the remaining hours until the end of the final day.
Button
The Button section allows you to customize, Button text, Link, Style, Alignment, and more.
By default, the button links to your store’s homepage, but you can replace it with any URL.
Once you finish configuring the block, changes are saved automatically. You can then continue editing your email.
Troubleshooting
Permalink Settings Issue
If you face any issues setting discount codes, please check the permalink settings in your WordPress admin. The 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.
💬 Find more information: https://woocommerce.github.io/woocommerce-rest-api-docs/#introduction
"Error: An Error Occurred in the Request"
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," follow these steps:
Step 1. Go to WooCommerce → Status → Tools.
Step 2. Scroll lower and click the "Verify database" button next to the "Verify base database tables" section.
Step 3. Afterwards, 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's 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 or Wordfence are not interfering with requests to these endpoints. If our integration can't access these endpoints, it is impossible to turn on the Unique Discount Codes at the WooCommerce admin panel.
FAQ
Why does my test email show XXXX-XXXX-XXXX or a blank space?
Test emails always show a placeholder. Discount codes are only generated when you send a campaign or automation to real recipients.
Can I restrict WooCommerce discount codes to specific categories or products?
Not yet. WooCommerce unique discount blocks apply to the entire cart. To create category-specific discounts, manually create a coupon in WooCommerce with category restrictions, then add it to Omnisend as a Static Discount Block.
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. Go to Marketing → Coupons to view it.
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, and don't use the "reuse codes" settings.
Need some extra guidance? Get in touch with our Support Team via in-app chat or at [email protected].




























