Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: UK counties no longer available #13101

Closed
chrismou opened this issue Apr 19, 2023 · 5 comments
Closed

[4.x]: UK counties no longer available #13101

chrismou opened this issue Apr 19, 2023 · 5 comments

Comments

@chrismou
Copy link

chrismou commented Apr 19, 2023

What happened?

Description

After upgrading to Craft Commerce 4, and spending far too long debugging to try to find out what Ive missed, it seems that the new Administrative Area concept doesn't include British Counties.

The issue is mostly around shipping in Commerce. The UK incorporates England, Scotland Wales and Northern Ireland, and while we're effectively considered a single country in Craft, in reality Northern Ireland is on the other side of the Irish Sea, and the Scottish Highlands are well outside of most shipping companies scope for, say, one day delivery.

So up to now we've based shipping rules on counties. But since upgrading, its no longer possible. This massively complicates things as, using DPD as an example, this is what they consider the Scottish Highlands

image

There's also Northern Ireland and various other offshore islands to consider

I tried manually creating an array of UK counties to use, but it turns out they're silent dropped when saving the address due to not validating against the list you have.

Is there any way around this? Perhaps a way of saving my own administrative area outside of your predefined list, with it still able to work as part of a shipping rule? Or do I have to completely rethink how shipping works for this site? Managing it by postcode is the only thing I can think of off the top of my head, but it's going to be a pain to manage

Craft CMS version

4.x

PHP version

8.1

@i-just
Copy link
Contributor

i-just commented Apr 21, 2023

Hi, thanks for reaching out. It sounds like you might want to have a look at: #11788.

The library (commerceguys/addressing) doesn’t come with UK subdivisions (more details in that discussion), but the solution mentioned there should allow the input and saving of plain text values.

You might also find this helpful: #12644.

@chrismou
Copy link
Author

@i-just Thanks, that actually is really useful. I've already switched the shipping rules to be postcode based, but I'd not had a chance to look into the counties not saving so hopefully this will solve it for me 👍

@bymayo
Copy link

bymayo commented Jun 22, 2023

@i-just Just jumping in on this as I posted a duplicate (Sorry!) But I don't see the solution Brandon posted actually allowing to display the Counties for UK, but only to display a field (Which i'm assuming as it's untested, just displays an input field, not a select)

I'm also a little confused as to why this can't be added to the core? As I assume a lot of developers will be using Craft and Craft Commerce in the UK, or outside of the UK but still want to ship to UK addresses and to neglect having UK Counties in the core system and needing to add them manually with a module seems a bit crazy to me.

As we'd essentially need to do this everytime we spin up a Commerce site using Craft 4 now.

@i-just
Copy link
Contributor

i-just commented Jun 22, 2023

Yes, if you use those events, the administrativeArea field will be a text input in the Control Panel, but you can render it as a dropdown in the front end. Additionally, from 4.5, you’ll be able to override the default address formatter and display the administrativeArea as part of the card view (#13242).

Data for the library (commerceguys/addressing) used to come from Google (issue explaining why counties are not provided: google/libaddressinput#193). It looks like commerceguys/addressing has taken ownership of that: https://github.com/commerceguys/addressing/blob/master/README.md?plain=1#L19, but as with Google’s dataset, it doesn’t come with UK subdivisions.

@brandonkelly
Copy link
Member

Craft 4.5.0 is out with a new event that makes it possible to customize address subdivisions (#13361).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants