Last active
April 4, 2025 05:07
-
-
Save brycejacobson/86377bd208ab40e2a370185c47db8f5b to your computer and use it in GitHub Desktop.
Add message to WooCommerce email if shipping method is local pickup.
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 | |
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