Skip to content

Instantly share code, notes, and snippets.

@blivic
Last active August 22, 2019 12:48
Show Gist options
  • Save blivic/2b3a13c887eb5890cd70ac61016f2ee8 to your computer and use it in GitHub Desktop.
Save blivic/2b3a13c887eb5890cd70ac61016f2ee8 to your computer and use it in GitHub Desktop.
WooCommerce - Add instructions for local pickup shipping method on thank you page
function mx_local_pickup_instructions_thank_you_page( $order_id ) {
$order = wc_get_order( $order_id );
$order_methods = array_map( function( $shipping ) { return $shipping->get_method_id(); }, $order->get_shipping_methods() );
if ( in_array( 'local_pickup', $order_methods ) ) {
?><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>
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2827.289219500384!2d13.861598315500528!3d44.87676287909845!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x477cd2dab537319f%3A0xe4e8e35508e29724!2sMedia+X!5e0!3m2!1shr!2shr!4v1566470675356!5m2!1shr!2shr" width="1200" height="400" frameborder="0" style="border:0" allowfullscreen></iframe>
<?php
}
}
add_action( 'woocommerce_thankyou', 'mx_local_pickup_instructions_thank_you_page' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment