Looking to display your store address for local pickup on the thank you page after a customer places an order? Use the code snippet below to make it happen!
function ts_local_pickup_thank_you_page_address( $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>Store address</h2> <p>You can pickup your order at the following address 12 hours after ordering.</p> <p> 23 Wani Peth<br/> Mahad Naka, Khed<br/> India<br/> +91 999XXX4500 </p><?php } } add_action( 'woocommerce_thankyou', 'ts_local_pickup_thank_you_page_address' );
Output
The store address has been added below the billing address on the order received page only when the ‘local pickup’ method is chosen by the customer.
Additionally, if you want to display personalized messages based on the shipping method, you can add a custom message on the WooCommerce thank you page based on the shipping method.