使用 AutomateWoo 插件将创建的优惠券限制为电子邮件地址

问题描述

我正在使用 documentation 工作流程在某些触发器上生成优惠券,触发器工作正常。

作为操作,我发送电子邮件并使用以下内容生成优惠券。这再次工作正常,它会根据模板生成优惠券。

   {{ advocate.generate_coupon | template: 'raf-advocate',prefix: 'raf-advocate-' }}

有没有办法将创建的优惠券限制为电子邮件地址?我可以使用 AutomateWoo {{ customer.email }} 中的变量来获取电子邮件地址。

我也尝试了以下方法,但我不知道您是否可以将其限制为电子邮件地址:

{{ customer.generate_coupon | template: 'raf-advocate' }}

解决方法

如果这对任何人有帮助,您可以在您的 functions.php 文件中设置一个过滤器,将其限制为一个电子邮件地址(在这种情况下,它需要您将电子邮件发送到的电子邮件地址)。

add_filter( 'automatewoo/variables/coupons/use_email_restriction','__return_true' );

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...