Email class
Creating a Custom Email Class
class YourNewEmail extends \YayMail\Abstracts\BaseEmail { private static $instance; /** * Defines the email type * 1. YAYMAIL_WITH_ORDER_EMAILS: emails that include order information * 2. YAYMAIL_NON_ORDER_EMAILS: emails that do not include order information * Default is YAYMAIL_WITH_ORDER_EMAILS if not set */ public $email_types = [ YAYMAIL_WITH_ORDER_EMAILS ]; public static function instance() { if ( null === static::$instance ) { static::$instance = new static(); } return static::$instance; } protected function __construct() { // This is your custom id. // It should be the same id as the WooCommerce email for easily handling. $this->id = 'your_new_email_template_id'; $this->title = 'Your New Email'; $this->recipient = 'Customer'; // Customer/Admin or Other sources. $this->source = [ 'plugin_id' => '3rd-plugin-slug', // This id is what ever you want 'plugin_name' => 'The plugin email belong to', ]; } }
Last updated
Was this helpful?