AutomateWoo can generate a unique coupon from a WooCommerce coupon template and include the code in a workflow email. For example, you can send a welcome discount that expires 14 days after it is generated.
Create a coupon template
↑ Back to top- Go to Marketing > Coupons and select Add coupon.
- Enter a recognizable coupon code for the template, such as
welcome15-template. - Set the discount type, amount, and any usage restrictions you want generated coupons to inherit.
- Set the coupon’s visibility to Private and publish it. The template is used to create new codes; it is not the code you send to customers.
Add a generated coupon to a workflow
↑ Back to top- Open or create an AutomateWoo workflow with a trigger that provides customer data, and add an Email – Send Email action.
- In the Variables panel, select
customer.generate_coupon. If your workflow provides guest data instead, useguest.generate_couponwhen available. - Select the template coupon. To set an expiry relative to when each coupon is generated, enter a number of days in expires, such as
14. - Select Copy to clipboard, then paste the variable into the email content where the code should appear.
- Finish configuring the workflow and save it.

The variable also lets you set a code prefix and usage limit. By default, generated codes use the prefix aw- and can be used once. If you leave expires blank, the generated coupon inherits the template’s expiry date, if one is set. See AutomateWoo variables for more information.
A unique code is not automatically restricted to the recipient’s email address. Review the template’s restrictions and the generated coupon before using the workflow.
Test the workflow
↑ Back to topPreview the email and send a test to yourself. A preview shows a placeholder, while sending a test creates a real test coupon marked [test]. Check the coupon’s discount, expiry, and restrictions, then test it at checkout. When the email and coupon work as expected, activate the workflow.
Developer resources
↑ Back to topQuestions and support
↑ Back to topSomething missing from this documentation? Still have questions and need assistance?
- If you have a question about a specific extension or theme you’d like to purchase, contact us to get answers.
- If you already purchased this product and need some assistance, get in touch with a Happiness Engineer via our support page and select this product’s name from the Product dropdown.