Support » Plugin: DHL Shipping Germany for WooCommerce » Pass the second address-field to DHL API?

  • Resolved sx1001

    (@sx1001)


    Hi all,

    when using the DHL online dashboard directly, one can enter TWO lines below the name with additional data, e.g. where the deliverer should place the package or similarly.

    In WooCommerce, I read that the house number belongs into the 1st street field. And in the WooCommerce checkout process, there’s a second field, where you can actually enter data like the appartment-number, hotel suite, building or similarly.

    But this field is never passed to the DHL label if generating the label using the plugin from the backend. Is there any way to change that behaviour?

    E.g. for the “DHL-Postnummer”, I use the company field already and pass the data via a custom code like here:
    https://wordpress.org/support/topic/post-number-is-missing-it-is-mandatory-for-packstation-delivery/

    Is there ANY way to have a custom code to also send/pass the second street field, if not empty, to the DHL plugin?

    Thanks so much!!!!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter sx1001

    (@sx1001)

    I’m pretty confident it can be done by using the filter ‘pr_shipping_dhl_label_args’!?
    Looks as if the shipping address 2 is not passed to DHL – am I right?

    Plugin Author Shadi Manna

    (@shadim)

    Address 2 is passed, but it is assumed to be the building number.

    You can manipulate the addresses using the filter you mentioned though.

    Thread Starter sx1001

    (@sx1001)

    What do you exactly mean? I mean, Address 2 is not forced by WooCommerce, i.e. the building number can also be entered in Address 1.

    So what is than done with Address 2? Is it simply attached/merged with Address 1?

    And which would be the second Name Field’s Name (the second Name Line that is, which is currently completely un-occupied)?

    So that I know which array Element I have to map (Address2 -> ?).

    Thanks so much!

    Thread Starter sx1001

    (@sx1001)

    EDIT:
    Problem is, I cannot find the concrete definition of pr_shipping_dhl_label_args and the data-structures of $args, to know how to handle… Somewhere in $args[‘shipping_address’]…

    Plugin Author Shadi Manna

    (@shadim)

    If address 2 is empty it is simply not passed, if that is what you are asking.

    I would simply output the $args array in debug mode (https://wordpress.org/support/article/debugging-in-wordpress/) to see what is passed and manipulate it as needed.

    Thread Starter sx1001

    (@sx1001)

    I’m forcing my customers to enter the Streetnumber in Address 1.
    So Address 1 contains Street+Number.

    So Address 2 is either empty, OR it contains a place, where the deliverer should place the package, e.g. a text like “In front of the summerhouse”.

    Right now, Address 2 is sent to DHL as a merge with Address 1 in ONE line.
    That’s not what I want.
    Address 1 is already complete with the streetnumber.
    I want Address 2 to be sent as a second Address line (as additional information to DHL)…

    Thread Starter sx1001

    (@sx1001)

    So actually, after digging further into it.
    My thought is:
    Address 2 should not be sent to DHL as a merge to address 1, but rather should be send as “Prefered Location” to DHL! That’s my expectation

    Thread Starter sx1001

    (@sx1001)

    It’s solved.
    I empty the “address_2” parameter, which is sent to DHL API, using custom functions.

    And via Javascript in the backend, I transfer the address_2 to the “Prefered location” input field of the label form.

    Plugin Author Shadi Manna

    (@shadim)

    Great to hear you were able to solve the issue.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Pass the second address-field to DHL API?’ is closed to new replies.