I'm looking to setup an affiliate program, starting with the email notifications like when someone applies the coupon code of a an affiliate user.
For example:
- Coupon code "Bob" applied by a customer.
- An email notification is sent to "bob@gmail.com" (an affiliate) about the coupon code "bob" applied by a customer in cart or checkout, before order is submitted.
I have tried to use (without any luck): $order->get_used_coupons()
Then once order is completed, an email notification will be sent again: "order was completed with exclusive code".