Hello @bmhabibi17
Try this:
add_filter('wpo_wcpdf_shipping_address', 'wpo_wcpdf_add_order_number_to_shipping_address', 10, 2);
function wpo_wcpdf_add_order_number_to_shipping_address( $shipping_address, $document )
{
$order = $document->order;
if( !empty($order) && $document->get_type() == 'packing-slip' ) {
$shipping_address = '';
if( !empty($shipping_company = $order->get_shipping_company()) ) {
$shipping_address .= $shipping_company . '<br>';
}
if( !empty($full_name = $order->get_formatted_shipping_full_name()) ) {
$shipping_address .= $full_name . '<br>';
}
if( !empty($order_number = $order->get_order_number()) ) {
$shipping_address .= 'Order number: ' . $order_number . '<br>';
}
if( !empty($address_1 = $order->get_shipping_address_1()) ) {
$shipping_address .= $address_1 . '<br>';
}
if( !empty($address_2 = $order->get_shipping_address_2()) ) {
$shipping_address .= $address_2 . '<br>';
}
if( !empty($city = $order->get_shipping_city()) ) {
$shipping_address .= $city . '<br>';
}
if( !empty($state = $order->get_shipping_state()) ) {
$shipping_address .= $state . '<br>';
}
if( !empty($postcode = $order->get_shipping_postcode()) ) {
$shipping_address .= $postcode . '<br>';
}
if( !empty($country = $order->get_shipping_country()) ) {
$shipping_address .= $country . '<br>';
}
}
return $shipping_address;
}
If you never worked with filters, please read this documentation: How to use filters