Automattic\WooCommerce\Internal\RestApi\Routes\V4\Settings\Emails
Controller::get_email_by_id
Get email instance by ID.
Method of the class: Controller{}
No Hooks.
Returns
\WC_Email|null. Email instance or null if not found.
Usage
// private - for code of main (parent) class only $result = $this->get_email_by_id( $email_id );
- $email_id(string) (required)
- Email ID.
Controller::get_email_by_id() Controller::get email by id code WC 10.4.3
private function get_email_by_id( string $email_id ) {
$emails = WC_Emails::instance()->get_emails();
foreach ( $emails as $email ) {
if ( $email->id === $email_id ) {
return $email;
}
}
return null;
}