BizPrint Print Manager for WooCommerce Print Shipping Issue
BizPrint Print Manager is easily Add Support for Printing WooCommerce Orders with BizPrint Cloud Print Service and Print to Anywhere in the World!
Check here when order print shipping information not shown.
How to add shipping detail on order print template
Just use below code and past in theme functions.php
and you are done!
Now you can see shipping on print order.
add_action( 'Zprint\templates\details-html\afterCustomerDetails', 'add_shipinfo_to_other_html', 10, 2 );
add_action( 'Zprint\templates\order-html\afterBaseCustomerDetails', 'add_shipinfo_to_other_html', 10, 2 );
function add_shipinfo_to_other_html( int $order_id, \WC_Order $order ) {
$order = wc_get_order( $order_id );
foreach( $order->get_shipping_methods() as $item_id => $item ){
$location_id = $item->get_meta('_pickup_location_id');
$location_name = $item->get_meta('_pickup_location_name');
$location_address = $item->get_meta('_pickup_location_address'); // Array
$location_address_1 = $location_address['address_1'];
$location_address_2 = $location_address['address_2'];
$location_postcode = $location_address['postcode'];
$location_city = $location_address['city'];
$location_state = $location_address['state'];
$location_country = $location_address['country'];
$location_phone = $item->get_meta('_pickup_location_phone');
$pickup_date = $item->get_meta('_pickup_appointment_start');
$pickup_min_hours = $item->get_meta('_pickup_minimum_hours');
}
echo '<tr>';
echo '<td>';
$pickup_date = date('Y-m-d h:i A ',$pickup_date);
$pickup_date = date('Y-m-d h:i A', strtotime($pickup_date. ' - 7 hours'));
echo $location_name.'<br>';
echo '<b>Address:</b>';
echo $location_address_1.' '.$location_address_2.'<br>';
echo $location_postcode.'<br>';
echo $location_city.'<br>';
echo $location_state.'<br>';
echo $location_country.'<br>';
echo '<b>Phone:</b>'.$location_phone.'<br>';
echo '<b>Pickup Date:</b>'.$pickup_date.'<br>';
echo $pickup_min_hours.'<br>';
echo '</td>';
echo '</tr>';
}