In Woocommerce, I just want to get "local pickup" shipping details to display on a custom email. I tried below functions but they don't show anything for "local pickup".
Which function I can use to get "local pickup" info?
I tried without success the following WC_Order
methods:
$order->get_shipping_address_1()
$order->get_formatted_shipping_address()
Edit:
Sorry I did not mention that, but I am using Local Pickup Plus plugin
Edit 2:
This is how I got local pickup info for Local Pickups Plus Plugin docs.woocommerce.com/document/local-pickup-plus which puts meta data to main order variable.
$order = wc_get_order( $order_id );
foreach ($order->get_data() as $key => $value):
if ($key==='shipping_lines'):
foreach ($value as $k=>$v):
$a = $v->get_meta_data();
foreach ($a as $x=>$y):
$t = $y->get_data();
$mykey = $t['key'] ;
$pickup["$mykey"] = $t['value'];
endforeach;
endforeach;
endif;
endforeach;
Then you can use the variables below:
$pickup['_pickup_location_name']
$pickup['_pickup_location_address']['address_1']
$pickup['_pickup_location_phone']['address_2']
$pickup['_pickup_location_address']['postcode']
$pickup['_pickup_location_address']['city']
$pickup['_pickup_location_address']['state'] $pickup['_pickup_location_address']['country']
$pickup['_pickup_location_phone']
$pickup['_pickup_date']
$pickup['_pickup_minimum_hours']