WooCommerce Code Reference
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Hook Reference
  • WooCommerce Docs
  • REST API Docs

Packages

  • None
  • WooCommerce
    • Abstracts
    • Admin
      • Customize
      • Functions
      • Importers
      • Meta
      • Reports
      • System
    • API
    • Classes
      • Data
        • Store
      • Emails
      • Embed
      • Integrations
      • Interfaces
      • Log
        • Handlers
      • Payment
      • Products
      • Shipping
      • Walkers
    • Export
    • Functions
    • Import
    • l10n
    • PaymentTokens
    • PayPal
    • Shortcodes
      • Cart
      • Checkout
      • My
        • Account
      • Order
        • Tracking
    • Webhooks
    • Widgets
  • WP-Background-Processing

Classes

  • WC_Email
  • WC_Email_Cancelled_Order
  • WC_Email_Customer_Completed_Order
  • WC_Email_Customer_Invoice
  • WC_Email_Customer_New_Account
  • WC_Email_Customer_Note
  • WC_Email_Customer_On_Hold_Order
  • WC_Email_Customer_Processing_Order
  • WC_Email_Customer_Refunded_Order
  • WC_Email_Customer_Reset_Password
  • WC_Email_Failed_Order
  • WC_Email_New_Order
  • WC_Emails

Class WC_Emails

Transactional Emails Controller

WooCommerce Emails Class which handles the sending on transactional emails and email templates. This class loads in available emails.

Package: WooCommerce\Classes\Emails
Category: Class
Author: WooThemes
Version: 2.3.0
Class: WC_Emails
Located at class-wc-emails.php

Methods summary

public static WC_Emails
# instance( )

Main WC_Emails Instance.

Main WC_Emails Instance.

Ensures only one instance of WC_Emails is loaded or can be loaded.

Returns

WC_Emails
Main instance

Since

2.1
public
# __clone( )

Cloning is forbidden.

Cloning is forbidden.

Since

2.1
public
# __wakeup( )

Unserializing instances of this class is forbidden.

Unserializing instances of this class is forbidden.

Since

2.1
public static
# init_transactional_emails( )

Hook in all transactional emails.

Hook in all transactional emails.

public static
# queue_transactional_email( )

Queues transactional email so it's not sent in current request if enabled, otherwise falls back to send now.

Queues transactional email so it's not sent in current request if enabled, otherwise falls back to send now.

public
# __construct( )

Constructor for the email class hooks in all emails that can be sent.

Constructor for the email class hooks in all emails that can be sent.

public
# init( )

Init email classes.

Init email classes.

public array
# get_emails( )

Return the email classes - used in admin to load settings.

Return the email classes - used in admin to load settings.

Returns

array
public string
# get_from_name( )

Get from name for email.

Get from name for email.

Returns

string
public string
# get_from_address( )

Get from email address.

Get from email address.

Returns

string
public
# email_header( mixed $email_heading )

Get the email header.

Get the email header.

Parameters

$email_heading
heading for the email
public
# email_footer( )

Get the email footer.

Get the email footer.

public string
# email_footer_replace_site_title( string $string )

Filter callback to replace {site_title} in email footer

Filter callback to replace {site_title} in email footer

Parameters

$string
Email footer text.

Returns

string
Email footer text with any replacements done.

Since

3.3.0
public string
# wrap_message( string $email_heading, string $message, boolean $plain_text = false )

Wraps a message in the woocommerce mail template.

Wraps a message in the woocommerce mail template.

Parameters

$email_heading
Heading text.
$message
Email message.
$plain_text
Set true to send as plain text. Default to false.

Returns

string
public boolean
# send( mixed $to, mixed $subject, mixed $message, string $headers = "Content-Type: text/html\r\n", string $attachments = "" )

Send the email.

Send the email.

Parameters

$to
$subject
$message
$headers
(default: "Content-Type: text/html\r\n")
$attachments
(default: "")

Returns

boolean
public
# customer_invoice( integer|WC_Order $order )

Prepare and send the customer invoice email on demand.

Prepare and send the customer invoice email on demand.

Parameters

$order
public
# customer_new_account( integer $customer_id, array $new_customer_data = array(), boolean $password_generated = false )

Customer new account welcome email.

Customer new account welcome email.

Parameters

$customer_id
$new_customer_data
$password_generated
public
# order_details( WC_Order $order, boolean $sent_to_admin = false, boolean $plain_text = false, string $email = '' )

Show the order details table

Show the order details table

Parameters

$order
$sent_to_admin
$plain_text
$email
public
# order_downloads( WC_Order $order, boolean $sent_to_admin = false, boolean $plain_text = false, string $email = '' )

Show order downloads in a table.

Show order downloads in a table.

Parameters

$order
$sent_to_admin
$plain_text
$email

Since

3.2.0
public
# order_meta( mixed $order, boolean $sent_to_admin = false, boolean $plain_text = false )

Add order meta to email templates.

Add order meta to email templates.

Parameters

$order
$sent_to_admin
(default: false)
$plain_text
(default: false)
public boolean
# customer_detail_field_is_valid( array $field )

Is customer detail field valid?

Is customer detail field valid?

Parameters

$field

Returns

boolean
public string
# customer_details( WC_Order $order, boolean $sent_to_admin = false, boolean $plain_text = false )

Allows developers to add additional customer details to templates.

Allows developers to add additional customer details to templates.

In versions prior to 3.2 this was used for notes, phone and email but this data has moved.

Parameters

$order
$sent_to_admin
(default: false)
$plain_text
(default: false)

Returns

string
public
# email_addresses( WC_Order $order, boolean $sent_to_admin = false, boolean $plain_text = false )

Get the email addresses.

Get the email addresses.

Parameters

$order
$sent_to_admin
$plain_text
public
# low_stock( WC_Product $product )

Low stock notification email.

Low stock notification email.

Parameters

$product
public
# no_stock( WC_Product $product )

No stock notification email.

No stock notification email.

Parameters

$product
public
# backorder( array $args )

Backorder notification email.

Backorder notification email.

Parameters

$args
public
# order_schema_markup( mixed $order, boolean $sent_to_admin = false, boolean $plain_text = false )

Adds Schema.org markup for order in JSON-LD format.

Adds Schema.org markup for order in JSON-LD format.

Deprecated

3.0.0

Parameters

$order
$sent_to_admin
(default: false)
$plain_text
(default: false)

Since

2.6.0

See

WC_Structured_Data::generate_order_data()

Properties summary

public array $emails

Array of email notification classes

Array of email notification classes

#
protected static WC_Emails $_instance

The single instance of the class

The single instance of the class

# null
protected static $background_emailer

Background emailer class.

Background emailer class.

#
WooCommerce Code Reference API documentation generated by ApiGen