Closed joostwaaijer closed 1 year ago
You are correct that the "Locality" field is not defined as a "used field" by our Google-supplied address data for the United Arab Emirates, but it looks like Paypal requires it.
To manually add it to the "used fields" data for that Country, please add the following to your project inside a module:
Event::on(
\craft\services\Addresses::class,
\craft\services\Addresses::EVENT_DEFINE_USED_FIELDS,
function (\craft\events\DefineAddressFieldsEvent $event) {
if($event->countryCode == 'AE'){
$fields = array_merge(['locality'],$event->fields);
$event->fields = $fields;
}
}
);
This will allow the field to be added to addresses for that country in the CP and the front-end.
Hope that helps.
Description Paypal checkout is returning the following error when trying to buy from United Arab Emirates:
The city is saved in the craft commerce systems as locality, but when checking the address forms for the United Arab Emirates, there is no possible way to set the locality, see image:
To Reproduce How, and what happened?
Expected behavior Orders from United Arab Emirates should be able to checkout.
Additional info