• Resolved mom4i911024

    (@mom4i911024)


    Hi there,

    On my shop I want to use two separate fields for street and house number. Billing address 1 is Street and Billing address 2 is House Number. However, in the backend order edit screen when I try to create a label for the shipment, I always get the error that the House Number is missing from address 1 and the label can’t be created. I’ve checked some of the code but i’m not sure how it has to be adjusted. Is it somewhere from woocommerce_gzd_shipment_default_address_fields or woocommerce_gzd_shipment_{$address_type}_address_fields hooks, or from somewhere else? Hopefully you can help, thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author vendidero

    (@vendidero)

    Hi there,

    Germanized expects (just like the Woo Core) the street + house number in the address_1 field. To make this work you’ll need to make sure that the address data is passed correctly while creating/syncing the shipment with the order. You could pass the address_1 field (including street + house number from the order) within the address data array by using the woocommerce_gzd_shipment_sync_props filter.

    See: https://github.com/vendidero/woocommerce-germanized-shipments/blob/master/src/SimpleShipment.php#L201

    PS: If in doubt, please contact a webdev to implement such customizations for you.

    Best,
    Dennis

    Thread Starter mom4i911024

    (@mom4i911024)

    Spot on! Thank you very much. Seems like all I had to do is this and now it works

    function myproject_combine_address_shipping($args, $object, $order_shipment) {
    	
    	$args['address']['address_1'] = $args['address']['address_1'] . ' ' . $args['address']['address_2'];
    	
            //Hide field on shipping label
    	$args['address']['address_2'] = '';
    
            return $args;
    }
    
    add_filter('woocommerce_gzd_shipment_sync_props', 'myproject_combine_address_shipping', 100, 3);
    • This reply was modified 1 year, 3 months ago by mom4i911024.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Separate Street and House Number’ is closed to new replies.