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

commerceguys/addressing v2 #14322

Merged
merged 3 commits into from
Feb 7, 2024

Conversation

brandonkelly
Copy link
Member

Description

Updates commerceguys/addressing to v2, and adds an “Address Line 3” address field.

Related issues

Copy link

linear bot commented Feb 7, 2024

@brandonkelly brandonkelly merged commit 4c42d8c into 5.0 Feb 7, 2024
@brandonkelly brandonkelly deleted the feature/cms-1257-commerceguysaddressing-v2 branch February 7, 2024 19:12
@bojanz
Copy link

bojanz commented Feb 8, 2024

Great work!

A possible followup might be to introduce usage of the SubdivisionUpdater in the record class.

That would auto-update administrative areas both for the 2.x ISO changes and other future renamings (e.g. ISO codes changed for a few Indian provinces, which we'll release in v2.2.0).

The Drupal version of the code looks like this:

public function setValue($values, $notify = TRUE) {
    // If a subdivision ID has changed, allow it to be remapped.
    // Primarily covers the 8.x-1.x => 2.0.x updates, where subdivisions
    // started being keyed by ISO code where available.
    if (isset($values['country_code'])) {
      if (isset($values['administrative_area'])) {
        $values['administrative_area'] = SubdivisionUpdater::updateValue($values['country_code'], $values['administrative_area']);
      }
      // Andorra is the only country with remapped localities.
      if ($values['country_code'] == 'AD' && isset($values['locality'])) {
        $values['locality'] = SubdivisionUpdater::updateValue($values['country_code'], $values['locality']);
      }
    }

    parent::setValue($values, $notify);
  }

@brandonkelly
Copy link
Member Author

Thanks for the suggestion @bojanz :) We’ve just done that here: #14386

@WHITE-developer
Copy link

Any chance this will come to Craft 4 also?

@brandonkelly
Copy link
Member Author

@WHITE-developer We only perform major updates of dependencies for major Craft releases.

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

Successfully merging this pull request may close these issues.

3 participants