Skip to content

Instantly share code, notes, and snippets.

@rynaldos-zz
Last active March 23, 2021 17:44
Show Gist options
  • Save rynaldos-zz/c0dfdc07652528327c6706fbdcad53c3 to your computer and use it in GitHub Desktop.
Save rynaldos-zz/c0dfdc07652528327c6706fbdcad53c3 to your computer and use it in GitHub Desktop.
[WooCommerce] Add the Shipping method to advanced notifications emails
// 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 method 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>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment