How to Add a Generated WooCommerce Coupon to Emails in the Block Email Editor

Including a unique discount coupon in your emails is one of the most effective ways to drive sales, reward loyal subscribers, and re-engage inactive customers. With the Coupon Code block in the block-based email editor, you can automatically generate WooCommerce coupons at send time — no need to create them manually in WooCommerce first.

This article covers how to use the generated coupon feature in both regular newsletters and automation emails.

Note: Looking for instructions on the legacy drag-and-drop editor? See Adding a Discount Coupon to Emails.

Requirements

Before you begin, make sure the following are in place:

  • WooCommerce 10.8.0 or later is installed and active on your site. The auto-generation feature is not available on older WooCommerce versions.
  • Coupon codes are enabled in WooCommerce. Go to WooCommerce > Settings > General > Enable coupons and tick the checkbox for Enable the use of coupon codes. See the WooCommerce coupon management guide for detailed steps.
  • You are editing your email in the block-based email editor, not the legacy drag-and-drop editor.

Understanding the Two Coupon Modes

When you insert a Coupon Code block into your email, you can choose between two modes in the block’s sidebar settings:

  • Create new — MailPoet generates a coupon automatically when the email is sent. You configure the discount rules (type, amount, expiry, and restrictions) directly in the editor. A placeholder code (XXXX-XXXXXX-XXXX) appears while editing and is replaced with a real code at send time.
  • Use existing — You search for and select a coupon that already exists in WooCommerce. The actual coupon code is displayed in the editor. No new coupon is generated.

The rest of this article focuses on the Create new mode.

How Generated Coupons Work in Different Email Types

The XXXX-XXXXXX-XXXX placeholder appears in the editor for both regular newsletters and automation emails. However, the behavior at send time is different:

Email typeWhat happens at send time
Regular newsletterMailPoet generates one coupon for the entire send. All recipients receive the same coupon code.
Automation emailMailPoet generates a unique coupon for each subscriber. Every recipient receives their own coupon code.

This difference exists because regular newsletters render the email body once and send the same content to every subscriber on the list. Automation emails render the email individually for each subscriber, allowing MailPoet to create a separate coupon each time.

Tip: Even though the placeholder looks identical in both email types while editing, the coupons generated at send time behave very differently. If you need every subscriber to receive their own unique code, use the coupon block inside an automation email rather than a regular newsletter.

After the email is sent, you can view all generated coupons under WooCommerce > Marketing > Coupons. Each generated coupon includes a description noting the MailPoet email it was created for.

Adding a Generated Coupon to a Regular Newsletter

  1. Go to MailPoet > Emails and create a new regular newsletter, or edit an existing draft.
  2. Open the email in the block-based email editor.
  3. Click the block inserter (the + icon) and search for Coupon Code. Insert the block where you want the coupon to appear in your email.
  4. With the Coupon Code block selected, open the block settings in the right sidebar.
  5. Set the Coupon source to Create new.
  6. Configure the coupon settings:
    • Discount type — Choose from Percentage discount, Fixed cart discount, or Fixed product discount.
    • Amount — Enter the discount value (for example, 10 for 10% off or $10 off).
    • Coupon expiry days — Set how many days the coupon remains valid after the email is sent. For example, entering 10 means the coupon expires 10 days after sending.
    • Free shipping — Toggle on if the coupon should also grant free shipping.
  7. Optionally, expand the Usage limits and Usage restriction sections to set additional rules such as minimum spend, maximum spend, product or category restrictions, or per-user usage limits.
  8. Save and send the email.

When the email is sent, the XXXX-XXXXXX-XXXX placeholder is replaced with a real coupon code. Because this is a regular newsletter, MailPoet creates exactly one coupon in WooCommerce, and all recipients receive the same code.

Adding a Generated Coupon to an Automation Email

  1. Go to MailPoet > Automations and open the automation that contains your email, or create a new one. See How to Set Up an Automation for guidance.
  2. Click the Send email step in your automation, then click Design email to open the block-based email editor.
  3. Click the block inserter (the + icon), search for Coupon Code, and insert the block into your email.
  4. With the block selected, set the Coupon source to Create new in the right sidebar.
  5. Configure the discount type, amount, expiry days, and any other settings as described in the regular newsletter steps above.
  6. Click Save and continue when you are done editing.

Because automation emails are sent to one subscriber at a time, MailPoet generates a brand new, unique coupon code for each recipient. You will see a separate coupon for each subscriber appear under WooCommerce > Marketing > Coupons after each email is sent.

Restricting a Coupon to the Subscriber Receiving the Email

By default, anyone who obtains a generated coupon code can use it at checkout — even if they are not the subscriber it was generated for. In automation emails, you can prevent coupon sharing by restricting the coupon to the recipient’s email address.

Note: This option is only available in automation emails when Create new is selected as the coupon source. It does not appear in regular newsletters, because newsletters generate a single shared coupon with no individual recipient to restrict it to.

To enable the restriction:

  1. Select the Coupon Code block in your automation email.
  2. In the right sidebar, scroll down to the Usage restriction panel added by MailPoet.
  3. Enable the toggle labeled Limit this coupon to the recipient’s email address.

When this toggle is enabled, MailPoet automatically adds the subscriber’s email address to the WooCommerce coupon’s allowed emails list. The coupon will only work when that specific email address is used at checkout.

You can verify this by going to WooCommerce > Marketing > Coupons, opening the generated coupon, and checking the Usage restriction tab.

Tip: You can also add other email addresses to the coupon’s allowed emails list in the Email restrictions field. When the restrict-to-subscriber toggle is enabled, both the subscriber’s email and any additional emails you specify will be allowed to use the coupon.

Configurable Coupon Settings

The following settings are available in the block sidebar when Create new is selected:

General

  • Discount type — Percentage discount, fixed cart discount, or fixed product discount.
  • Amount — The discount value. For percentage discounts, the maximum is 100.
  • Coupon expiry days — Number of days the coupon is valid after the email is sent. Leave at 0 for no expiration.
  • Free shipping — Whether the coupon also grants free shipping.

Usage Limits

  • Usage limit per coupon — How many times the coupon can be used in total before it becomes invalid.
  • Usage limit per user — How many times a single customer can use the coupon.

Usage Restrictions

  • Minimum spend — The minimum cart subtotal required to use the coupon.
  • Maximum spend — The maximum cart subtotal allowed for the coupon.
  • Individual use only — If enabled, the coupon cannot be combined with other coupons.
  • Exclude sale items — If enabled, the coupon will not apply to items already on sale.
  • Products — Restrict the coupon to specific products.
  • Excluded products — Exclude specific products from the coupon.
  • Product categories — Restrict the coupon to specific product categories.
  • Excluded product categories — Exclude specific product categories from the coupon.
  • Allowed emails — Restrict coupon usage to specific email addresses (comma-separated).

For a detailed explanation of each WooCommerce coupon option, see the WooCommerce coupon management guide.

Troubleshooting

The generated coupon UI does not appear in the editor

The Create new coupon source option requires WooCommerce 10.8.0 or later. Check your WooCommerce version under Plugins > Installed Plugins. If you are running an older version, update WooCommerce to access this feature. On older versions, you can still use the Use existing mode to insert a pre-created WooCommerce coupon.

The email shows XXXX-XXXXXX-XXXX instead of a real coupon code

This placeholder is expected while editing and previewing the email. It is replaced with a real coupon code only when the email is actually sent. If the placeholder appears in a delivered email, check that WooCommerce is active and that coupons are enabled in WooCommerce > Settings > General.

Sending fails with a coupon generation error

MailPoet validates coupon settings before sending. If something is misconfigured — for example, a percentage discount amount greater than 100, or an invalid product ID — MailPoet will stop the send and display an error message. Review the coupon block settings and correct any issues before trying again.

The “Restrict to subscriber email” toggle does not appear

This toggle is only available in automation emails when the Create new coupon source is selected. It is not available in regular newsletters or when using the Use existing mode.

Related Articles