I want to change the woocommerce email header template with a new one so that I could add conditions in header template to get value from the dashboard (To change the color of header based on user input from the dashboard). I have created a plugin file to do so.
I have followed several tutorials and all I received is a bunch of errors. I have a class with the following code:
public function __construct(){
add_action('woocommerce_email',array($this,'woocommerce_email'));
}
Now I have added code to remove default header hook
public function woocommerce_email($mailer){
remove_action('woocommerce_header',array($mailer,'email_header'));
add_action('woocommerce_header',array($this,'email_header'));
now calling the template
public function email_header() {
wc_get_template( 'emails/email-header.php');
}
I am not passing anything to the template file. So no parameters are passed to functions. I just wanted to see that my template is being taken.
Also, I assume $mailer
to be a part of the woocommerce class. Any help would be appreciated.
Please note that this is a plugin functionality so I am not interested in replacing the woocommerce email templates.
woocommerce/emails/email-header.php
and the original e-mail submission will use itemail_header
of your class, just display the file of your plugin, withrequire
e.g.