AutomateWoo: Use the customer.generate_coupon variable

This reference is for developers configuring AutomateWoo email content. It covers the customer.generate_coupon variable, its template-coupon prerequisite, and the checks to complete before enabling a replacement workflow.

Note:

This is a Developer level doc. If you are unfamiliar working with code and resolving potential conflicts, we recommend you work with a Woo Agency Partner for larger projects, or find a WooCommerce developer on Codeable for smaller customizations. We are unable to provide support for customizations under our Support Policy.

Prerequisites

↑ Back to top
  • Create or confirm a coupon to use as the template, and note its exact coupon code.
  • Keep the replacement workflow disabled until you have completed the verification steps below.

Use the generated-coupon variable

↑ Back to top

Add the variable to the AutomateWoo Send Email action:

{{ customer.generate_coupon | template:'welcome' }}

Replace welcome with the exact code of the coupon template you want to use. The template supplies the discount, usage limits, eligible products, and expiry settings for the generated coupon.

Expected result

↑ Back to top

When the workflow runs in a customer context, AutomateWoo generates a unique coupon from the template and inserts the generated coupon into the email content.

Verify the workflow before enabling it

↑ Back to top
  1. Review the template coupon’s discount, usage, product, and expiry settings.
  2. Add the variable to the AutomateWoo email content and replace welcome with the template coupon code.
  3. Preview the email with test data and confirm that the recipient, message, and coupon details are correct.
  4. Run a test event while the workflow is disabled, then check the AutomateWoo queue or logs and the received email.
  5. Enable the workflow only after confirming that the coupon is generated as expected and that the corresponding Follow-Up Emails workflow is disabled.

Troubleshoot missing or invalid coupons

↑ Back to top
  • Confirm that the template coupon code matches the value after template:.
  • Confirm that the email is being generated in a customer context that can resolve the variable.
  • Review the template coupon’s discount, usage, product, and expiry settings before testing again.

Risk and recovery

↑ Back to top

Do not enable the replacement while the original Follow-Up Emails workflow is active, because both workflows could send messages or generate coupons. If a test fails, leave the replacement disabled, confirm the template code and customer context, review the queue or logs, and test again.

Related documentation

↑ Back to top

Related Products

Offer Royal Mail shipping rates to your customers.

Get shipping rates from the Canada Post Ratings API which handles both domestic and international parcels.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.