• Resolved bmhabibi17

    (@bmhabibi17)


    Dear Team,

    How to Add Order_number after User Name in Shipping Adrress in Packing Slip?

    Thanks

    • This topic was modified 4 years, 6 months ago by bmhabibi17.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    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

    Thread Starter bmhabibi17

    (@bmhabibi17)

    Dear Team,

    It’s Work.

    So Proud using this Plugin.

    Thanks so much.

    Plugin Contributor alexmigf

    (@alexmigf)

    You’re welcome ??

    Have a nice day!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add Order _number after name User Name in Shipping Address’ is closed to new replies.