Theme Integration
1. Override YayMail Templates with Theme
YayMail allows developers to override email templates directly from their theme. This enables advanced customization of email structure without modifying plugin files or adding code snippets.
This approach works similarly to how WooCommerce templates can be overridden from a theme.
Editing plugin files directly is not recommended because any changes will be lost when the plugin updates. Instead, overriding templates from a theme provides an upgrade-safe way to customize templates.
To customize a template, copy the desired file from the plugin into your theme using the following structure:
your-theme/
└── yaymail/
└── emails/
template-file.php
Once the file exists in your theme, YayMail will load this template instead of the default plugin template.
This allows you to safely customize the email layout and logic without editing the plugin core files.
When YayMail loads a template, it passes the following variables to the template file.
$template
$templateContains the YayMail template instance used to render the email layout.
$args
$argsAn array containing the data used in the email template.
Depending on the email type, $args may include:
Order information
Customer data
Email settings
Other contextual data
Example usage:
You can use this data to customize the email content or display additional information.
Last updated
Was this helpful?