1. Documentation /
  2. Extensions /
  3. Smart Coupons /
  4. How to change, replace and override email template

How to change, replace and override email template

Smart Coupons provide a powerful, “all-in-one” solution for gift cards, store credits, discount coupons, and vouchers extending the core functionality of WooCommerce coupons.

This doc article explains how you can change, replace and override the coupons’ email template.

All emails sent from Smart Coupons, including the coupon code, are sent via existing templates (overridable) that are located in the ‘templates‘ directory of Smart Coupons – /woocommerce-smart-coupons/templates/.

If you want to change or modify the content of an email or if you want to change the email layout, there are two ways to do it:

Apply change in the file (Upgrade-unsafe): ↑ Back to top

Open file ‘/woocommerce-smart-coupons/templates/email.php‘. Modify its content and style as needed. Note: This method is not recommended, as you’ll lose changes after updating Smart Coupons to a newer version.

Use another template file (Upgrade-safe): ↑ Back to top

Use your own email template in place of the default one provided by Smart Coupons. Copy the template into a directory named ‘woocommerce’ within your theme keeping the same file structure but removing the ‘templates’ subdirectory.

Here’s how:

  • Create a template file and keep the file name as: email.php. Other file names will not work.
  • Open your themes folder and check if you have a folder named woocommerce. If not, create a folder named woocommerce
  • Open woocommerce folder and create a new folder inside it. Keep the folder’s name as – woocommerce-smart-coupons.
  • Place the file email.php inside woocommerce-smart-coupons. For example: To override the email template of the coupon’s email, copy: wp-content/plugins/woocommerce-smart-coupons/templates/email.php to wp-content/themes/yourtheme/woocommerce/woocommerce-smart-coupons/email.php.

The copied file will now override the WooCommerce Smart Coupons default template files.

Smart Coupons will use your template file (if found) for all emails sent from Smart Coupons.

You can follow this same method for these email templates of the Smart Coupons plugin:

  1. combined-email.php – This email template is used when the setting under WooCommerce > Settings > Smart Coupons > Combine emails is enabled.
  2. acknowledgement-email.php – This email template is used when an email is sent from the store to the purchaser of the coupon who has sent some coupons to someone else to acknowledge the purchaser of the coupons

Notes

1. We recommend using the child theme if you are overriding the templates as explained above. Read more here: Set up and use a child theme.
2. The above method is considered customization. We are happy to provide guidance, but we are unable to provide support or help to suit your store. Only use it if you are comfortable with PHP and custom coding and troubleshooting on your own.

WooCommerce

The most customizable eCommerce platform for building your online business.

  • 30 day money back guarantee
  • Support teams across the world
  • Safe & Secure online payment