This PHP code automatically sends an email to the customers billing email address when they use a specific coupon and the order is complete in WooCommerce. The download folder also includes code to add a custom message to the order email if desired as the order email is HTML and the custom email is text.
In this example, we create a coupon named maggie and use it on the checkout page. Once the order is complete, the customer received a customized email on top of their order receipt email.
Installation
Copy and paste the PHP code to your child themes functions file or custom functionality plugin.
Note : Depending on your web host, you may need to install a SMTP email plugin to handle sending emails directly from your WordPress installation as most don’t support email.
SMTP plugins enable you to send your emails through different email providers including Gmail, Amazon, Zohomail and Microsoft to name a few which guaranteed your messages are delivered.
We used gmail which requires some focus and time to setup using this tutorial : Set up WP Mail SMTP using the Google Workspace / Gmail mailer with your Gmail or Google Workspace email address.
Reviews
There are no reviews yet.