0

With woocommerce i can set a coupon code for discount. Is it possible to get the coupon code that the user filled in. I want the shop owner to get a mail with the coupon code the user filled in. Is there a hook that can capture the coupon code field data? Thanks in advance.

1

You could use the woocommerce_applied_coupon hook. You find the "implementation" in the class WC_Cart ( method apply_coupon)

Usage example:

function my_little_coupon_func($coupon_code)
{
    echo "coupon is correct: ". $coupon_code;

    // now send your email

}

add_action('woocommerce_applied_coupon', 'my_little_coupon_func');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.