Custom Email not Getting Template
-
Hi folks,
I’m in the middle of developing a small plugin for my site to integrate my WooCommerce store with a third-party. This integration is meant to pull a code from that third-party and then email it to the customer when they buy certain products.
After following some tutorials, I’ve managed to get a new transactional email set up, and I can get WooCommerce to send it on an appropriate hook. The trouble is, I was wanting to include the email template inside my plugin itself, and for the life of me I can’t get it to work. I validated that everything worked by putting the tempalte in the woocommerce/templates/emails folder where it sent fine, and I’ve also got it working by putting it in a woocommerce/emails folder within my theme. When I just direct it to use the template in the plugin directory, nothing happens.
I *think* this is an issue with the email’s ‘template_base’ field. I’ve set it to ‘WP_PLUGIN_DIR . ‘/my-email-plugin/templates/”, with the template_html as ’emails/code-email.php’, but it seems to still be looking in the native woocommerce directory for the template, as I can sub in other vanilla WC emails in the ‘template_html’ field and it sends them instead.
The custom email is registered in the WooCommerce Settings-> Email page, and when I click on it, I’m able to view the template in the plugin directory fine. It just seems to freak out when it tries to send it.
Any help would be most welcome!
The topic ‘Custom Email not Getting Template’ is closed to new replies.