-
-
Save monecchi/65f21a7bc07b9b872c500475b7364159 to your computer and use it in GitHub Desktop.
WooCommerce add shipping method to emails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>'; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment