Commit Graph

3 Commits

Author SHA1 Message Date
edbb69a239 Use the woocommerce_email action to customize WC emails
This commit changes the WC action that MailPoet uses to hook into WC and
customize the footer and the header of WC e-mails. Before, MailPoet was
using the woommerce_init action. The problem with using this action to customize
the e-mails is that it runs on every request. Furthermore, since we were calling
WC->mailer() inside the callback, we were instantiating WC_Emails on
every single request (WooCommerce instantiate this class only when
needed).

Replacing woocommerce_init with woocommerce_email means that our code
will run only when needed (right after WooCommerce adds callbacks to the
actions woocommerce_email_header and woocommerce_email_footer) and that
we won't be unnecessarily instantiating WC_Emails ourselves. We get the
singleton instance of this class as a parameter.

[MAILPOET-3421]
2021-03-01 14:14:19 +01:00
9e9270f13b Use email heading from Woo for email header
We want to use email heading from Woo in title of rendered email for
WooCommerce Transactional Email.

[MAILPOET-3329]
2021-01-25 11:08:00 +01:00
fbc6786058 Split class to prevent circular dependency
[MAILPOET-2899]
2020-05-28 11:28:51 +02:00