- 🇮🇳India mdmanouwer
I have this configuration and work well
please used following class
use CommerceGuys\Addressing\AddressFormat\AddressField;
use CommerceGuys\Addressing\AddressFormat\FieldOverride;$form['member_address_container']['address'] = [
'#type' => 'fieldset',
'#title' => 'Address',
];
$form['member_address_container']['address']['who_is_paying_address'] = [
'#type' =>'address',
'#default_value' => ['country_code' => 'CA'],
'#field_overrides' => [
AddressField::ADDRESS_LINE1 => FieldOverride::OPTIONAL,
AddressField::ADDRESS_LINE2 => FieldOverride::OPTIONAL,
AddressField::POSTAL_CODE => FieldOverride::OPTIONAL,
AddressField::GIVEN_NAME => FieldOverride::HIDDEN,
AddressField::FAMILY_NAME => FieldOverride::HIDDEN,
AddressField::ORGANIZATION => FieldOverride::HIDDEN,
AddressField::ADMINISTRATIVE_AREA => FieldOverride::OPTIONAL,
AddressField::LOCALITY => FieldOverride::OPTIONAL,],
'#available_countries' => ['CA'],
];