• Resolved Danny

    (@quering)


    Hi Ewout,

    Great plugin!
    I am having issues with the following:
    I would like to create an if-statement within my own packing slip template, to display the shipping OR billing address. Now both are showed and if the shipping address is empty, it showws the text “N/A”. I would like to use it like this:

    if (!empty(shipping_address)) {
    // Dipsplay shipping address
    }
    else {
    // Display billing address
    }

    How can I achieve this? Thanks a lot!

    Danny

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hello Danny,
    This should work:

    
    if ( $shipping_address = $this->order->get_formatted_shipping_address() ) {
    	echo $shipping_address;
    } else {
    	echo $this->order->get_formatted_billing_address();
    }
    

    Good luck!

    Hello, I have this issue as well. Where do we place this code you provided?

    • This reply was modified 5 years, 2 months ago by kaotik.
    Plugin Contributor kluver

    (@kluver)

    Hi @kaotik,

    This code should be placed in a custom template. More information here: creating a custom template

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display shipping address OR billing address in template’ is closed to new replies.