📌  相关文章
📜  woocommerce 优惠券通知特定电子邮件 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:07.395000             🧑  作者: Mango

代码示例1
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 = "jack.hoover@gmail.com"; // 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 );
    }
}