WooCommerce order emails often carry the same message to every customer, regardless of where that customer lives. For many stores, that is a missed opportunity. A shopper in Germany may need VAT invoice details, a buyer in Australia may need customs timing guidance, and a customer in the United States may benefit from local return instructions. By adding country-based text after the order table, a store can make order confirmation emails more useful, more compliant, and more personal.
TLDR: WooCommerce allows developers to insert custom content after the order table by using the woocommerce_email_after_order_table hook. A store can check the customer’s billing or shipping country and display a specific message, such as “Orders shipped to Canada may require 2 additional customs processing days.” In a store processing 1,000 monthly international orders, even a 15% reduction in “Where is my order?” support tickets can save hours of customer service time. This customization is usually added through a child theme’s functions.php file or a small custom plugin.
Why Country-Based Email Text Matters
Transactional emails are some of the most opened messages in ecommerce. Customers expect order confirmation emails, shipping notifications, and invoice emails to contain practical information. When a store sells internationally, a single generic note may not answer the questions different customers have.
Country-based email text can help with:
- Shipping expectations: Some destinations may have longer customs processing times.
- Tax and VAT information: Certain regions may require clear tax or invoice notes.
- Returns and exchanges: Return addresses or policies may vary by country.
- Legal notices: Different countries may require specific consumer rights or compliance text.
- Localized trust: A message tailored to the customer’s country can make the email feel more relevant.
The placement after the order table is especially useful because the customer has just reviewed the purchased products, totals, and payment details. A short country-specific note placed there feels natural and visible without interrupting the main order information.
The WooCommerce Hook Used for This Customization
WooCommerce provides hooks inside its email templates. To add text after the order table, the most useful hook is:
woocommerce_email_after_order_table
This hook passes several values to the custom function, including the order object. The order object allows the store to retrieve billing and shipping country codes. For example, the United States is usually represented as US, Canada as CA, Germany as DE, and Australia as AU.
In many cases, the shipping country is the best choice because shipping-related messages should depend on the destination. However, for tax, invoice, or billing compliance messages, the billing country may be more appropriate.
Example Code: Add Text Based on Shipping Country
The following example adds a short message after the order table in WooCommerce emails. It checks the customer’s shipping country first. If no shipping country exists, it falls back to the billing country.
add_action( 'woocommerce_email_after_order_table', 'custom_country_based_email_text', 10, 4 );
function custom_country_based_email_text( $order, $sent_to_admin, $plain_text, $email ) {
if ( ! $order instanceof WC_Order ) {
return;
}
$country = $order->get_shipping_country();
if ( empty( $country ) ) {
$country = $order->get_billing_country();
}
$messages = array(
'US' => 'Orders within the United States usually arrive within 3 to 5 business days after dispatch.',
'CA' => 'Orders shipped to Canada may require additional customs processing time.',
'DE' => 'Customers in Germany will receive VAT details on the invoice where applicable.',
'AU' => 'Orders shipped to Australia may take 7 to 14 business days after dispatch.'
);
if ( isset( $messages[ $country ] ) ) {
if ( $plain_text ) {
echo "\n" . $messages[ $country ] . "\n";
} else {
echo '<p style="margin-top:20px;"><strong>Important notice:</strong> ' . esc_html( $messages[ $country ] ) . '</p>';
}
}
}
This code should normally be placed in a child theme’s functions.php file or, preferably, in a small site-specific plugin. A custom plugin is often safer because it keeps the customization active even if the theme changes.
Choosing Between Billing and Shipping Country
The correct country source depends on the purpose of the message. A store should not automatically use one field for every situation. Instead, it should match the message to the customer data that makes the most sense.
- Use shipping country for delivery estimates, customs notes, courier limits, and regional fulfillment instructions.
- Use billing country for tax statements, invoice requirements, payment notices, and legal billing information.
- Use both carefully when the store needs to detect cross-border orders, such as a customer billing in one country and shipping to another.
For example, a customer may live in France but send a gift to Japan. A customs note should probably be based on Japan, while a VAT or billing statement may need to refer to France.
Making the Message More Flexible
The basic example works well for a small set of countries. Larger stores may need a more flexible structure. Instead of hardcoding every message directly in the function, a developer might create a settings page, use custom fields, or store messages in an options array.
Even with a simple approach, the message should remain concise. Transactional emails are not the place for long policy pages. A helpful note might be only one or two sentences, followed by a link to the full shipping or returns page if needed.
Good country-based email text should be:
- Specific: It should explain something relevant to that country.
- Short: It should not distract from the order confirmation.
- Accurate: It should reflect current shipping, tax, or support rules.
- Consistent: It should match the store’s public policies.
- Readable: It should work in both HTML and plain text emails.
Targeting Specific WooCommerce Emails
Some stores may not want the message to appear in every WooCommerce email. The hook can run in several email types, so the function may check the email ID before displaying the custom text.
For example, the store may only want the note in the customer processing order email and not in admin notifications. WooCommerce email IDs can vary by email type, but common examples include customer_processing_order, customer_completed_order, and customer_invoice.
if ( $email && ! in_array( $email->id, array( 'customer_processing_order', 'customer_completed_order' ), true ) ) {
return;
}
This condition can be added near the top of the function. It keeps the customization focused and prevents unnecessary text from appearing in internal store emails or unrelated customer messages.
Testing the Customization
Before using the code on a live store, the store team should test several order examples. Testing should include domestic orders, international orders, guest checkout orders, and orders without a separate shipping address.
A practical testing checklist includes:
- Creating test orders for each targeted country.
- Checking both HTML and plain text email output.
- Confirming that admin emails do not show customer-only notes unless intended.
- Reviewing the message on mobile email clients.
- Verifying that special characters, currency symbols, and tax terms display correctly.
Common Mistakes to Avoid
One common mistake is adding the message directly to WooCommerce template files. This can work temporarily, but template changes may be overwritten during updates. Hooks are usually cleaner and easier to maintain.
Another mistake is forgetting plain text emails. Some customers and email clients still use plain text versions, and WooCommerce supports them. A polished customization should handle both HTML and plain text output.
Stores should also avoid making promises that operations cannot guarantee. For instance, saying “delivery will arrive in 3 days” may create frustration if customs or courier delays occur. A safer message says, “delivery usually arrives within 3 to 5 business days after dispatch.”
FAQ
Can country-based text be added without editing WooCommerce templates?
Yes. The recommended method is to use the woocommerce_email_after_order_table hook. This avoids direct template edits and is easier to maintain during WooCommerce updates.
Should the message use billing country or shipping country?
It depends on the message. Shipping notices should usually use the shipping country, while tax or invoice notes often fit better with the billing country.
Will the customization appear in all WooCommerce emails?
By default, the hook may run in multiple email types. The function can check the email ID to limit the message to specific customer emails.
Is this safe to add to a theme file?
It can be added to a child theme’s functions.php file, but a small custom plugin is often better. A plugin keeps the feature separate from the active theme.
Can different messages be shown for multiple countries?
Yes. The function can use an array of country codes and messages. Each country code can display a different note after the order table.
