Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails
WCTransactionalEmailPostsGenerator::generate_email_template_if_not_exists
Generate email template if it doesn't exist.
This function generates an email template if it doesn't exist.
Method of the class: WCTransactionalEmailPostsGenerator{}
No Hooks.
Returns
Int. The post ID of the generated template.
Usage
$WCTransactionalEmailPostsGenerator = new WCTransactionalEmailPostsGenerator(); $WCTransactionalEmailPostsGenerator->generate_email_template_if_not_exists( $email_type );
- $email_type(string) (required)
- The email type.
WCTransactionalEmailPostsGenerator::generate_email_template_if_not_exists() WCTransactionalEmailPostsGenerator::generate email template if not exists code WC 10.3.6
public function generate_email_template_if_not_exists( $email_type ) {
$email_data = $this->default_templates[ $email_type ];
if ( $this->template_manager->get_email_template_post_id( $email_type ) || empty( $email_data ) ) {
return $this->template_manager->get_email_template_post_id( $email_type );
}
return $this->generate_single_template( $email_type, $email_data );
}