Skip to content

Allow opting countries out of states_required at seed time#6458

Open
shaggybelco wants to merge 1 commit intosolidusio:mainfrom
shaggybelco:fix/3803-germany-states-not-required
Open

Allow opting countries out of states_required at seed time#6458
shaggybelco wants to merge 1 commit intosolidusio:mainfrom
shaggybelco:fix/3803-germany-states-not-required

Conversation

@shaggybelco
Copy link
Copy Markdown

Carmen exposes German Bundesländer as subregions, so the default seeder marks Germany's Spree::Country#states_required as true. PayPal and Braintree do not return state data for German addresses, which then fails Solidus's address validation at checkout.

Introduce a countries_not_requiring_states preference (default ["DE"]) and consult it from both the country seeder and the country factory. The Spree::Country.iso == "DE" row will be seeded with states_required = false going forward, and host applications can extend the list (e.g. ["DE", "ES"]) without monkey-patching the seeder.

Existing seeded databases keep their current values; this only affects new installs and freshly created Spree::Country records.

Closes #3803

Summary

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

Carmen exposes German Bundesländer as subregions, so the default
seeder marks Germany's `Spree::Country#states_required` as `true`.
PayPal and Braintree do not return state data for German addresses,
which then fails Solidus's address validation at checkout.

Introduce a `countries_not_requiring_states` preference (default
`["DE"]`) and consult it from both the country seeder and the country
factory. The `Spree::Country.iso == "DE"` row will be seeded with
`states_required = false` going forward, and host applications can
extend the list (e.g. `["DE", "ES"]`) without monkey-patching the
seeder.

Existing seeded databases keep their current values; this only affects
new installs and freshly created `Spree::Country` records.

Closes solidusio#3803
@shaggybelco shaggybelco requested a review from a team as a code owner April 25, 2026 14:00
@github-actions github-actions Bot added the changelog:solidus_core Changes to the solidus_core gem label Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:solidus_core Changes to the solidus_core gem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set states_required to false for Germany

1 participant