Title: sim0nm's Replies | WordPress.org

---

# sim0nm

  [  ](https://wordpress.org/support/users/sim0nm/)

 *   [Profile](https://wordpress.org/support/users/sim0nm/)
 *   [Topics Started](https://wordpress.org/support/users/sim0nm/topics/)
 *   [Replies Created](https://wordpress.org/support/users/sim0nm/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/sim0nm/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/sim0nm/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/sim0nm/engagements/)
 *   [Favorites](https://wordpress.org/support/users/sim0nm/favorites/)

 Search replies:

## Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[DHL Shipping Germany for WooCommerce] Shipping “Address 2” is empty!](https://wordpress.org/support/topic/shipping-address-2-is-empty/)
 *  [sim0nm](https://wordpress.org/support/users/sim0nm/)
 * (@sim0nm)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/shipping-address-2-is-empty/#post-11148568)
 * [https://pastebin.com/auyxfJVw](https://pastebin.com/auyxfJVw) (untested)
 * As i said, this relies on [https://github.com/VIISON/AddressSplitting](https://github.com/VIISON/AddressSplitting)
   which is basically a huge and complex regex, it was way easier to just use that
   than to roll my own regex.
 * Introducing that as a dependency for internal usage isn’t a problem for me, but
   for the plugin itself it might.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[DHL Shipping Germany for WooCommerce] Shipping “Address 2” is empty!](https://wordpress.org/support/topic/shipping-address-2-is-empty/)
 *  [sim0nm](https://wordpress.org/support/users/sim0nm/)
 * (@sim0nm)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/shipping-address-2-is-empty/#post-11145037)
 * A short followup:
 * A workaround seems to be:
 * Hook into the DHL args with a filter:
 * `add_filter('pr_shipping_dhl_label_args', array($this, 'fix_dhl_address'), 2,
   10);`
 * and to set the args fields there, e.g.:
 *     ```
       $args['shipping_address']['address_1'] = $split['streetName'];
       			$args['shipping_address']['address_2'] = $split['houseNumber'];
       ```
   
 * (We use this: [https://github.com/VIISON/AddressSplitting](https://github.com/VIISON/AddressSplitting))
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[DHL Shipping Germany for WooCommerce] Shipping “Address 2” is empty!](https://wordpress.org/support/topic/shipping-address-2-is-empty/)
 *  [sim0nm](https://wordpress.org/support/users/sim0nm/)
 * (@sim0nm)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/shipping-address-2-is-empty/#post-11144271)
 * Hi,
    can confirm and this is clearly a bug. The assumption that house “numbers”
   are numeric is wrong: Check out:
 * [https://de.wikipedia.org/wiki/Hausnummer#Hausnummernerg%C3%A4nzungen](https://de.wikipedia.org/wiki/Hausnummer#Hausnummernerg%C3%A4nzungen)
 * or
 * [https://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/](https://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/)
 * Another example to make it clearer:
 * Teststr. 2A is a valid format.
 * This happens in:
 *     ```
       // ...last found number will be 'address_2'
       				foreach ($address_exploded as $address_key => $address_value) {
       					if (is_numeric($address_value)) {
       						// Set last index as street number
       						$args['shipping_address']['address_2'] = $address_value;
       						$set_key = $address_key;
       					}
       				}
       ```
   
 * class-pr-dhl-api-soap-label.php
 * It would be better to not make any assumptions about the adress field at all (
   just accept the first part and let DHL handle the rest, e.g. _fail_ if the DHL
   API can’t handle it?)
 * Has this anything to do with the adress being DHL codeable? If so, can’t the 
   DHL API handle that? Does it report back if the adresss is not codeable?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[DHL Shipping Germany for WooCommerce] Display order number on the shipping label](https://wordpress.org/support/topic/display-order-number-on-the-shipping-label/)
 *  [sim0nm](https://wordpress.org/support/users/sim0nm/)
 * (@sim0nm)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/display-order-number-on-the-shipping-label/#post-11102857)
 * This should be possible via the “customerReference” Argument (in ShipmentOrder-
   > ShipmentDetails of e.g. a SOAP Request to the DHL API).
 * From the DHL API docs:
 * > ShipmentOrder. Shipment. ShipmentDetails.
   >  customerReference String maxLength:
   > 35 Optional A reference number that the client can assign for better association
   > purposes. Appears on shipment label.
 * In the meantime it would be great to have a filter on the return value of set_message()
   in dhl-for-woocommerce/includes/pr-dhl-api/class-pr-dhl-api-soap-label.php, e.
   g.:
 * `return apply_filters('pr_shipping_dhl_label_soap_message', $this->body_request);`
 * A filter for $dhl_label_body would work as well, before:
 *     ```
       // Unset/remove any items that are empty strings or 0, even if required!
       $this->body_request = $this->walk_recursive_remove( $dhl_label_body );
       ```
   
 * (I know the pr_shipping_dhl_label_args filter exists, but that only allows manipulation
   of existing args, can’t add/inject anything to the request itself).
 * Basically a one-liner for you Shadi without breaking anything, for my use case
   it’s probably enough. Wouldn’t need to hack it into the plugin itself (stays 
   updateable).
    -  This reply was modified 7 years, 3 months ago by [sim0nm](https://wordpress.org/support/users/sim0nm/).
      Reason: fix typo

Viewing 4 replies - 1 through 4 (of 4 total)