To put order data in the email body text, you can make use of the following placeholders:
{admin_email}– the site admin email{currency}– the order currency{customer_ip_address}– IP address of the customer at the time of checkout{customer_note}– the customer notes{date_completed}– the date when the order was completed{date_created}– the date the order was created{date_modified}– the date the order was last modified{date_paid}– the date of payment{email_date}– the date the email was sent{email_date|+5 days}– the date the email was sent with an offset set in days. Change the number according to needs (+1, -5, etc){email_date|+1 week}– the date the email was sent with an offset set in weeks. Change the number according to needs (+1, -5, etc){order_date}– the order date{order_date|+5 days}– the order date with an offset set in days. Change the number according to needs (+1, -5, etc){order_date|+1 week}– the order date with an offset set in weeks. Change the number according to needs (+1, -5, etc){order_items_table}– table with all the order items{order_notes}– the order notes{order_number}– the order number{order_received_url}– the payment method URL{order_status}– the order status name{order_time}– the order time{order_total}– the order total{payment_method}– the payment method name{payment_method_description}– the payment method description{payment_method_instructions}– the payment method instructions{payment_method_thankyou_page_text}– the payment method thank you page text{payment_url}– url to pay for the order{private_order_notes}– the private order notes{review_products}– list of products from the order that have not been reviewed by this customer{shipping_method}– the shipping method name{shipping_notes}– the shipping / customer notes (entered by the customer in the checkout){site_title}– the site title{status}– the order status slug{unsubscribe_link}– clickable link to unsubscribe from all reminder emails{unsubscribe_reminder_link}– clickable link to unsubscribe from the specific reminder email{unsubscribe_reminder_url}– url to unsubscribe from the specific reminder email{unsubscribe_url}– url to unsubscribe from all reminder emails
Billing address #
{billing_address}– the full billing address, formatted by WooCommerce{billing_address_1}– the first address line of the billing address{billing_address_2}– the second address line of the billing address{billing_city}– the city name of the billing address{billing_company}– the company name of the billing address{billing_country}– name of the country of the billing address{billing_first_name}– the first name of the billing address{billing_last_name}– the last name of the billing address{billing_email}– the email address of the billing address{billing_phone}– the phone number of the billing address{billing_postcode}– the ZIP code of the billing address{billing_state}– the name of the state of the billing address
Shipping address #
{shipping_address}– the full shipping address, formatted by WooCommerce{shipping_address_1}– the first address line of the shipping address{shipping_address_2}– the second address line of the shipping address{shipping_city}– the name of the city of the shipping address{shipping_company}– the company name of the shipping address{shipping_country}– the name of the country of the shipping address{shipping_first_name}– the first name of the shipping address{shipping_last_name}– the last name of the shipping address{shipping_postcode}– the ZIP code of the shipping address{shipping_state}– the name of the state of the shipping address
Custom fields #
Custom fields can be included the same way, simply put the name (meta key) of the custom field between brackets, so if your custom field name has the meta key _billing_custom, the placeholder for it is {_billing_custom}
Create a custom placeholder #
This is advanced and requires some basic PHP knowledge. Alongside the existing placeholders, creating a custom placeholder can be done using the following WordPress filter hook structure:
wpo_wcsre_replace_ABCDE
…where the ‘ABCDE‘ part is the new placeholder that will be introduced. Therefore, to introduce the new {all_product_descriptions} placeholder for use in our reminder emails, we use the following hook in our code snippet:
wpo_wcsre_replace_all_product_descriptions
Complete example code snippet:
/**
* WP Overnight
* Introducing a new placeholder to display all product descriptions.
**/
add_filter( 'wpo_wcsre_replace_all_product_descriptions', 'wpo_handle_all_product_descriptions_placeholder', 10, 2 );
function wpo_handle_all_product_descriptions_placeholder( string $output, WC_Abstract_Order $order ): string {
$product_descriptions = array();
foreach ( $order->get_items() as $item ) {
$product = $item->get_product();
if ( $product ) {
$product_descriptions[] = $product->get_description();
}
}
$output = implode( "\n", $product_descriptions );
return $output;
}In the reminder email editor, the new placeholder can now be used:
The order was placed on {order_date}
Here are the product descriptions:
{all_product_descriptions}