Closed (fixed)
Project:
Address
Version:
8.x-1.4
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Feb 2019 at 14:39 UTC
Updated:
15 Jan 2021 at 05:04 UTC
Jump to comment: Most recent
Comments
Comment #2
panchoIf you want the house number be required: are you sure there are no valid addresses without house number in the UK? At least in Germany, in some small hamlets, these exist. Apart from that, how do you know the entered data is valid? Furthermore, how about P.O. boxes?
I think you can't do a proper validation without actual street data. There's a free, open-source postcode API at https://postcodes.io. Additionally/alternatively you can use paid services such as Google, getAddress, PostCoder or Ideal. There's probably more - I just did a short Google lookup.
Comment #3
bojanz commentedPancho is right, you probably don't want to make that field required.
In any case, the usual way of collecting a house number is to repurpose address_line2.
See https://docs.drupalcommerce.org/commerce2/developer-guide/customers/addr... for an example
Comment #5
pieterdcThanks for that hint @bojanz
I also needed hook_commerce_inline_form_alter() to make the alterations work on eg. the checkout pane, instead of only on the profile pages.
Comment #6
giorgio79 commented"The usual way of collecting house number is repurposing a field"?
Hmm, house number is a pretty default element in any address...