Following up on the post about adding the Payment Type to your WooCommerce emails, a reader asked how they would be able to also add the Shipping Method to the WooCommerce emails.

Again WooCommerce does add a lot of information to the emails that goes out to the customers and admin but there are some things that are not part of the emails and another one of those things are the Shipping Method.

The shipping method could useful to display in emails to let shop admin knows how to ship the order if these emails are being used as packaging slips, or to let the customer know what type of shipping they selected at checkout.

To add the shipping method to all WooCommerce emails or just add it to the admin emails add the following code to your theme’s functions.php file.


<?php
// Place the following code in your theme's functions.php file to add the shipping method to all emails
add_action( 'woocommerce_email_after_order_table', 'wc_add_shipping_method_to_emails', 15, 2 );
function wc_add_shipping_method_to_emails( $order, $is_admin_email ) {
echo '<p><strong>Shipping Method:</strong> ' . $order->get_shipping_method() . '</p>';
}
// Place the following code in your theme's functions.php file to add the shipping methid to admin emails only
add_action( 'woocommerce_email_after_order_table', 'wc_add_shipping_method_to_admin_emails', 15, 2 );
function wc_add_shipping_method_to_admin_emails( $order, $is_admin_email ) {
if ( $is_admin_email ) {
echo '<p><strong>Shipping Method:</strong> ' . $order->get_shipping_method() . '</p>';
}
}
?>

view raw

functions.php

hosted with ❤ by GitHub