Skip to content

Instantly share code, notes, and snippets.

@brycejacobson
Last active April 4, 2025 05:07
Show Gist options
  • Save brycejacobson/86377bd208ab40e2a370185c47db8f5b to your computer and use it in GitHub Desktop.
Save brycejacobson/86377bd208ab40e2a370185c47db8f5b to your computer and use it in GitHub Desktop.
Add message to WooCommerce email if shipping method is local pickup.
<?php
add_action( 'woocommerce_email_before_order_table', 'add_order_email_instructions', 10, 2 );
function add_order_email_instructions( $order, $sent_to_admin ) {
$shipping_method = @array_shift( $order->get_shipping_methods() );
$shipping_method_id = $shipping_method['method_id'];
if ( ! $sent_to_admin ) {
if ( 'local_pickup:5' == $shipping_method_id ) {
// local pickup option
echo '<p><strong>Instructions:</strong> Please contact us at 000-000-000 to arrange a pick-up time.</p>';
} else {
// other methods
echo '';
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment