我正在寻找设置联属网络营销计划,从电子邮件通知开始,例如当有人应用联属网络营销用户的优惠券代码时。
例如:
(没有任何运气):$order->get_used_coupons()
woocommerce_applied_coupon
这里只是一个功能示例,当使用优惠券时将发送电子邮件(电子邮件地址名称收件人设置为优惠券名称)。
您需要根据自己的需要对其进行自定义:
add_action( 'woocommerce_applied_coupon', 'custom_email_on_applied_coupon', 10, 1 );
function custom_email_on_applied_coupon( $coupon_code ){
if( $coupon_code == 'bob' ){
$to = "[email protected]"; // Recipient
$subject = sprintf( __('Coupon "%s" has been applied'), $coupon_code );
$content = sprintf( __('The coupon code "%s" has been applied by a customer'), $coupon_code );
wp_mail( $to, $subject, $content );
}
}
代码进入您的活动子主题(或主题)的 function.php 文件或任何插件文件中。
感谢您的帮助。