Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save blivic/3ae59a8f8788e8696caaa98731aea6a8 to your computer and use it in GitHub Desktop.
Save blivic/3ae59a8f8788e8696caaa98731aea6a8 to your computer and use it in GitHub Desktop.
WooCommerce - Add instructions for local pickup shipping method in processing and completed email notifications
function mx_local_pickup_instructions_order_email( $order, $sent_to_admin, $plain_text, $email ) {
// Only for processing and completed email notifications to customer
if( ! ( 'customer_processing_order' == $email->id || 'customer_completed_order' == $email->id ) ) return;
foreach( $order->get_items('shipping') as $shipping_item ){
$shipping_rate_id = $shipping_item->get_method_id();
$method_array = explode(':', $shipping_rate_id );
$shipping_method_id = reset($method_array);
if( 'local_pickup' == $shipping_method_id ){
?><h2>Ime trgovine</h2>
<p>Naručene artikle možete preuzeti u našoj trgovini.</p>
<p>
Moja ulica b.b.<br/>
52100, Pula<br/>
+385 99 123456<br/><br/>
Radno vrijeme: <br/>
Pon-Pet 08-20<br/>
Sub 08-13
</p>
<p><a href="https://www.google.com/maps/place/Media+X/@44.8767629,13.8615983,17z/data=!3m1!4b1!4m5!3m4!1s0x477cd2dab537319f:0xe4e8e35508e29724!8m2!3d44.8767629!4d13.863787" target="_blank">Pogledaj lokaciju na Google kartama</a></p>
<?php
}
}
}
add_action( 'woocommerce_email_after_order_table', 'mx_local_pickup_instructions_order_email', 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment