Email placeholders

To put order data in the email body text, you can make use of the following placeholders:

  • {admin_email} – the site admin email
  • {site_title} – the site title
  • {unsubscribe_url} – url to unsubscribe from emails
  • {unsubscribe_link} – clickable link to unsubscribe from emails
  • {order_items_table} – table with all the order items
  • {review_products} – list of products from the order that have not been reviewed by this customer
  • {order_number} – the order number
  • {email_date} – the date the email was sent
  • {order_date} – the order date
  • {order_time} – the order time
  • {date_paid} – the date of payment
  • {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
  • {order_total} – the order total
  • {shipping_method} – the shipping method name
  • {payment_method} – the payment method name
  • {payment_url} – url to pay for the order
  • {shipping_notes} – the shipping / customer notes (entered by the customer in the checkout)
  • {order_notes} – the order notes
  • {customer_note} – the customer notes
  • {private_order_notes} – the private order notes
  • {customer_ip_address} – IP address of the customer at the time of checkout
  • {status} – the order status slug
  • {currency} – the order currency
  • {order_received_url} – the payment method URL
  • {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

Billing address #

  • {billing_company} – the company name of the billing address
  • {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_postcode} – the ZIP code of the billing address
  • {billing_country} – name of the country of the billing address
  • {billing_state} – the name of the state of the billing address
  • {billing_email} – the email address of the billing address
  • {billing_phone} – the phone number of the billing address

Shipping address #

  • {shipping_address} – the full shipping address, formatted by WooCommerce
  • {shipping_first_name} – the first name of the shipping address
  • {shipping_last_name} – the last name of the shipping address
  • {shipping_company} – the company name of the shipping address
  • {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_postcode} – the ZIP code of the shipping address
  • {shipping_country} – the name of the country 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 ‘{ABCDE}‘ 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}