• Resolved FlatText

    (@flattext)


    Hi,

    Would love to add labels to the address on “order_addresses” section in print-content.php.

    Right now it can be confusing for delivery personnel if the user has not explicitly mentioned Road number etc.

    For example, this is a sample address the way it is currently:

      Username
      Company name
      address
      address 2
      city
      1234

    derived from
    echo wp_kses_post( apply_filters( 'wcdn_address_billing', $order->get_formatted_billing_address(), $order ) );

    What do I need to do to output the labels of these fields to display like this:

      CLIENT NAME: Username
      CLIENT COMPANY: Company name
      CLIENT ADDRESS_1: address
      CLIENT ADDRESS_2: address 2
      CLIENT CITY: city
      1234

    I can replace

    echo wp_kses_post( apply_filters( 'wcdn_address_billing', $order->get_formatted_billing_address(), $order ) );

    with

    echo 'Address 1 '.$order->get_billing_address_1().', ';
    echo 'Address 2 '.$order->get_billing_address_2().', ';
    echo 'City '.$order->get_billing_city().', ';
    echo 'State '.$order->get_billing_state();

    But is there a more elegant solution?

    Thank you

Viewing 1 replies (of 1 total)
  • Plugin Support kenil802

    (@kenil802)

    Hi @flattext,

    Regarding the query, can you please add the below code and check whether it works or not.

    Code:

    add_filter( ‘wcdn_address_billing’, ‘change_address_billing’, 10, 2 );
    function change_address_billing( $billing_address, $order ) {
    $billing_address = ‘Address 1 ‘.$order->get_billing_address_1(). ‘, ‘.
    ‘Address 2 ‘.$order->get_billing_address_2().’, ‘. ‘City ‘. $order->get_billing_city().’, ‘. ‘State ‘.$order->get_billing_state();
    return $billing_address;
    }

    Also, you can change the value of $billing_address as per your needs.

    Regards,
    Kenil Shah

    • This reply was modified 5 years, 1 month ago by kenil802.
Viewing 1 replies (of 1 total)
  • The topic ‘Display labels for Billing/Shipping Address’ is closed to new replies.