Hello @ahranalytics
I don’t a copy of that plugin to test, but I believe it saves those addresses somehow in the order data. I suggest you to contact their support to know how is done and how to get them.
If you could post here their message I might could help you.
I can give you a copy. Let me know your email address.
@alexmigf
Done! thank you!
Please see my message on the email that you’ve provided.
Hi @ahranalytics
Please add the code snippet below to your theme functions.php file:
add_action( 'wpo_wcpdf_after_shipping_address', function( $document_type, $order ) {
$packages = get_post_meta( $order->get_id(), '_wcms_packages', true );
if( ! empty($packages) ) {
$counter = 0;
foreach( $packages as $address ) {
$counter++;
$output = '<br>';
$output .= '<h3>'.__( 'Shipping Address', 'woocommerce-pdf-invoices-packing-slips' ).' '.$counter.'</h3>';
if( ! empty($address['destination']['first_name']) ) {
$output .= $address['destination']['first_name'];
if( ! empty($address['destination']['last_name']) ) {
$output .= ' '.$address['destination']['last_name'];
}
$output .= '<br>';
}
if( ! empty($address['destination']['company']) ) {
$output .= $address['destination']['company'].'<br>';
}
if( ! empty($address['destination']['address_1']) ) {
$output .= $address['destination']['address_1'];
if( ! empty($address['destination']['address_2']) ) {
$output .= ' '.$address['destination']['address_2'];
}
$output .= '<br>';
}
if( ! empty($address['destination']['postcode']) ) {
$output .= $address['destination']['postcode'];
if( ! empty($address['destination']['city']) ) {
$output .= ' '.$address['destination']['city'];
}
$output .= '<br>';
}
if( ! empty($address['destination']['state']) ) {
$output .= $address['destination']['state'].'<br>';
}
if( ! empty($address['destination']['country']) ) {
$country = !empty(WC()->countries) ? WC()->countries->countries[ $address['destination']['country'] ] : null;
$output .= $country.'<br>';
}
echo $output;
}
}
}, 10, 2 );
If you never worked with actions/filters please read this documentation page: How to use filters
@alexmigf
thank you but it only works in packing slip. I need it also in the Invoice? Is this possible?
Hi @ahranalytics
I believe it should work on both, you just need to enable the Shipping Address in the settings to show “always”.
@alexmigf
Thanks for responding. However Im a little bit confused, where I could find that in the settings tried to look from WooCommerce > Settings > Shipping and I couldnt find it.
Help please thank you!
Plugin Contributor
kluver
(@kluver)
It is a setting in the PDF Invoices & Packing Slips plugin. Via WooCommerce > PDF Invoices > Documents > Invoice > Display shipping address.