WC_Emails
in package
Emails class.
Table of Contents
- $emails : array<string|int, WC_Email>
- Array of email notification classes
- $_instance : WC_Emails
- The single instance of the class
- $background_emailer : WC_Background_Emailer
- Background emailer class.
- __clone() : mixed
- Cloning is forbidden.
- __construct() : mixed
- Constructor for the email class hooks in all emails that can be sent.
- __wakeup() : mixed
- Unserializing instances of this class is forbidden.
- additional_address_fields() : mixed
- Renders any additional address fields captured during block-based checkout.
- additional_checkout_fields() : mixed
- Renders any additional fields captured during block-based checkout.
- backorder() : mixed
- Backorder notification email.
- customer_detail_field_is_valid() : bool
- Is customer detail field valid?
- customer_details() : mixed
- Allows developers to add additional customer details to templates.
- customer_invoice() : mixed
- Prepare and send the customer invoice email on demand.
- customer_new_account() : mixed
- Customer new account welcome email.
- email_addresses() : mixed
- Get the email addresses.
- email_footer() : mixed
- Get the email footer.
- email_footer_replace_site_title() : string
- Filter callback to replace {site_title} in email footer
- email_header() : mixed
- Get the email header.
- get_emails() : array<string|int, WC_Email>
- Return the email classes - used in admin to load settings.
- get_from_address() : string
- Get from email address.
- get_from_name() : string
- Get from name for email.
- init() : mixed
- Init email classes.
- init_transactional_emails() : mixed
- Hook in all transactional emails.
- instance() : WC_Emails
- Main WC_Emails Instance.
- low_stock() : mixed
- Low stock notification email.
- no_stock() : mixed
- No stock notification email.
- order_details() : mixed
- Show the order details table
- order_downloads() : mixed
- Show order downloads in a table.
- order_meta() : mixed
- Add order meta to email templates.
- order_schema_markup() : mixed
- Adds Schema.org markup for order in JSON-LD format.
- queue_transactional_email() : mixed
- Queues transactional email so it's not sent in current request if enabled, otherwise falls back to send now.
- replace_placeholders() : string
- Replace placeholder text in strings.
- send() : bool
- Send the email.
- wrap_message() : string
- Wraps a message in the woocommerce mail template.
- get_blogname() : string
- Get blog name formatted for emails.
Properties
$emails
Array of email notification classes
public
array<string|int, WC_Email>
$emails
= array()
$_instance
The single instance of the class
protected
static WC_Emails
$_instance
=
ull
$background_emailer
Background emailer class.
protected
static WC_Background_Emailer
$background_emailer
=
ull
Methods
__clone()
Cloning is forbidden.
public
__clone() : mixed
Tags
Return values
mixed —__construct()
Constructor for the email class hooks in all emails that can be sent.
public
__construct() : mixed
Return values
mixed —__wakeup()
Unserializing instances of this class is forbidden.
public
__wakeup() : mixed
Tags
Return values
mixed —additional_address_fields()
Renders any additional address fields captured during block-based checkout.
public
additional_address_fields(string $address_type, WC_Order $order[, bool $sent_to_admin = false ][, bool $plain_text = false ]) : mixed
Parameters
- $address_type : string
-
Address type.
- $order : WC_Order
-
Order instance.
- $sent_to_admin : bool = false
-
If email is sent to admin.
- $plain_text : bool = false
-
If this is a plain text email.
Return values
mixed —additional_checkout_fields()
Renders any additional fields captured during block-based checkout.
public
additional_checkout_fields(WC_Order $order[, bool $sent_to_admin = false ][, bool $plain_text = false ]) : mixed
Parameters
- $order : WC_Order
-
Order instance.
- $sent_to_admin : bool = false
-
If email is sent to admin.
- $plain_text : bool = false
-
If this is a plain text email.
Return values
mixed —backorder()
Backorder notification email.
public
backorder(array<string|int, mixed> $args) : mixed
Parameters
- $args : array<string|int, mixed>
-
Arguments.
Return values
mixed —customer_detail_field_is_valid()
Is customer detail field valid?
public
customer_detail_field_is_valid(array<string|int, mixed> $field) : bool
Parameters
- $field : array<string|int, mixed>
-
Field data to check if is valid.
Return values
bool —customer_details()
Allows developers to add additional customer details to templates.
public
customer_details(WC_Order $order[, bool $sent_to_admin = false ][, bool $plain_text = false ]) : mixed
In versions prior to 3.2 this was used for notes, phone and email but this data has moved.
Parameters
- $order : WC_Order
-
Order instance.
- $sent_to_admin : bool = false
-
If should sent to admin.
- $plain_text : bool = false
-
If is plain text email.
Return values
mixed —customer_invoice()
Prepare and send the customer invoice email on demand.
public
customer_invoice(int|WC_Order $order) : mixed
Parameters
- $order : int|WC_Order
-
Order instance or ID.
Return values
mixed —customer_new_account()
Customer new account welcome email.
public
customer_new_account(int $customer_id[, array<string|int, mixed> $new_customer_data = array() ][, bool $password_generated = false ]) : mixed
Parameters
- $customer_id : int
-
Customer ID.
- $new_customer_data : array<string|int, mixed> = array()
-
New customer data.
- $password_generated : bool = false
-
If password is generated.
Return values
mixed —email_addresses()
Get the email addresses.
public
email_addresses(WC_Order $order[, bool $sent_to_admin = false ][, bool $plain_text = false ]) : mixed
Parameters
- $order : WC_Order
-
Order instance.
- $sent_to_admin : bool = false
-
If should sent to admin.
- $plain_text : bool = false
-
If is plain text email.
Return values
mixed —email_footer()
Get the email footer.
public
email_footer() : mixed
Return values
mixed —email_footer_replace_site_title()
Filter callback to replace {site_title} in email footer
public
email_footer_replace_site_title(string $string) : string
Parameters
- $string : string
-
Email footer text.
Tags
Return values
string — Email footer text with any replacements done.email_header()
Get the email header.
public
email_header(mixed $email_heading) : mixed
Parameters
- $email_heading : mixed
-
Heading for the email.
Return values
mixed —get_emails()
Return the email classes - used in admin to load settings.
public
get_emails() : array<string|int, WC_Email>
Return values
array<string|int, WC_Email> —get_from_address()
Get from email address.
public
get_from_address() : string
Return values
string —get_from_name()
Get from name for email.
public
get_from_name() : string
Return values
string —init()
Init email classes.
public
init() : mixed
Return values
mixed —init_transactional_emails()
Hook in all transactional emails.
public
static init_transactional_emails() : mixed
Return values
mixed —instance()
Main WC_Emails Instance.
public
static instance() : WC_Emails
Ensures only one instance of WC_Emails is loaded or can be loaded.
Tags
Return values
WC_Emails — Main instancelow_stock()
Low stock notification email.
public
low_stock(WC_Product $product) : mixed
Parameters
- $product : WC_Product
-
Product instance.
Return values
mixed —no_stock()
No stock notification email.
public
no_stock(WC_Product $product) : mixed
Parameters
- $product : WC_Product
-
Product instance.
Return values
mixed —order_details()
Show the order details table
public
order_details(WC_Order $order[, bool $sent_to_admin = false ][, bool $plain_text = false ][, string $email = '' ]) : mixed
Parameters
- $order : WC_Order
-
Order instance.
- $sent_to_admin : bool = false
-
If should sent to admin.
- $plain_text : bool = false
-
If is plain text email.
- $email : string = ''
-
Email address.
Return values
mixed —order_downloads()
Show order downloads in a table.
public
order_downloads(WC_Order $order[, bool $sent_to_admin = false ][, bool $plain_text = false ][, string $email = '' ]) : mixed
Parameters
- $order : WC_Order
-
Order instance.
- $sent_to_admin : bool = false
-
If should sent to admin.
- $plain_text : bool = false
-
If is plain text email.
- $email : string = ''
-
Email address.
Tags
Return values
mixed —order_meta()
Add order meta to email templates.
public
order_meta(WC_Order $order[, bool $sent_to_admin = false ][, bool $plain_text = false ]) : mixed
Parameters
- $order : WC_Order
-
Order instance.
- $sent_to_admin : bool = false
-
If should sent to admin.
- $plain_text : bool = false
-
If is plain text email.
Return values
mixed —order_schema_markup()
Adds Schema.org markup for order in JSON-LD format.
public
order_schema_markup(WC_Order $order[, bool $sent_to_admin = false ][, bool $plain_text = false ]) : mixed
Parameters
- $order : WC_Order
-
Order instance.
- $sent_to_admin : bool = false
-
If should sent to admin.
- $plain_text : bool = false
-
If is plain text email.
Tags
Return values
mixed —queue_transactional_email()
Queues transactional email so it's not sent in current request if enabled, otherwise falls back to send now.
public
static queue_transactional_email(mixed ...$args) : mixed
Parameters
- $args : mixed
-
Optional arguments.
Return values
mixed —replace_placeholders()
Replace placeholder text in strings.
public
replace_placeholders(string $string) : string
Parameters
- $string : string
-
Email footer text.
Tags
Return values
string — Email footer text with any replacements done.send()
Send the email.
public
send(mixed $to, mixed $subject, mixed $message[, string $headers = "Content-Type: text/html
" ][, string $attachments = '' ]) : bool
Parameters
- $to : mixed
-
Receiver.
- $subject : mixed
-
Email subject.
- $message : mixed
-
Message.
- $headers : string = "Content-Type: text/html "
-
Email headers (default: "Content-Type: text/html\r\n").
- $attachments : string = ''
-
Attachments (default: "").
Return values
bool —wrap_message()
Wraps a message in the woocommerce mail template.
public
wrap_message(string $email_heading, string $message[, bool $plain_text = false ]) : string
Parameters
- $email_heading : string
-
Heading text.
- $message : string
-
Email message.
- $plain_text : bool = false
-
Set true to send as plain text. Default to false.
Return values
string —get_blogname()
Get blog name formatted for emails.
private
get_blogname() : string