• Resolved paulrmiller2000

    (@paulrmiller2000)


    Hey guys,

    We were hoping to remove billing_address_2 (which is what we use for shipping) from our checkout page. When we did so, the plugin had trouble validating the address. Not a surprise, since it was looking for address line 2! 🙂

    So, we’ve temporarily restored billing_address_2. Is there a way we can modify the plugin so it doesn’t check for address_2?

    For reference, here’s the code we were using in functions.php to remove billing_address_2:

    function wpb_custom_billing_fields( $fields = array() ) {
    	unset($fields['billing_address_2']);
    	return $fields;
    }
    add_filter('woocommerce_billing_fields','wpb_custom_billing_fields');

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • xadapter

    (@xadapter)

    Hi,

    Since the plugin communicates with the carrier’s API to validate the address, if there’s few elements missing from the request the ApI will not be able to validate the address, it will show validation failed message.

    Regards,

    Thread Starter paulrmiller2000

    (@paulrmiller2000)

    Makes sense, and thanks for the quick response!

    We decided to just hide it with CSS. For anyone who needs it, here’s what we added:

    input#billing_address_2.input-text { 
        height: 0px;
        width: 0px;
        padding: 0;
        border: 0;
    }
    
    #billing_address_2_field.form-row.form-row-wide.address-field { 
        margin: 0px; 
        padding: 0px;
    }
    xadapter

    (@xadapter)

    Hi Paul,

    Great!! and thanks for sharing the code with us 🙂 if you’re happy with the plugin do leave us a review here: https://ww.wp.xz.cn/support/plugin/address-validation-woocommerce/reviews/

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

The topic ‘Remove billing_address_2’ is closed to new replies.