Support » Plugin: PDF Invoices & Packing Slips for WooCommerce » Add Multiple Addresses in PDF Invoice

  • Resolved ahranalytics

    (@ahranalytics)


    I am using shipping multiple addresses plugin from woocommerce and I am wondering if it is possible to put the multiple addresses in the invoice?

    Can someone help me? Thank you!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    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.

    Thread Starter ahranalytics

    (@ahranalytics)

    I can give you a copy. Let me know your email address.

    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @ahranalytics

    Contact us by email to support@wpovernight.com

    Thread Starter ahranalytics

    (@ahranalytics)

    @alexmigf

    Done! thank you!

    Please see my message on the email that you’ve provided.

    Plugin Contributor alexmigf

    (@alexmigf)

    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

    Thread Starter ahranalytics

    (@ahranalytics)

    @alexmigf

    thank you but it only works in packing slip. I need it also in the Invoice? Is this possible?

    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @ahranalytics

    I believe it should work on both, you just need to enable the Shipping Address in the settings to show “always”.

    Thread Starter ahranalytics

    (@ahranalytics)

    @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.

    Thread Starter ahranalytics

    (@ahranalytics)

    Thanks you!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Add Multiple Addresses in PDF Invoice’ is closed to new replies.