Skip to content

Add optional first_name to Spree::Address behind a configuration flag #6633

Description

@jarednorman

Background

Solidus 3.0 collapsed firstname/lastname on Spree::Address into a single name column (#3234). That remains the right default, but some stores (notably in EU markets, see #6110) need a separate given name for e-invoicing and for third-party services that require split names. Some stores use solidus_address_name or your their own customizations to extract names from addresses.

#6159 attempted to bring split names back into core, and the discussion there produced a design the core team agreed on. That PR has gone stale, so this issue captures the agreed design so a fresh PR can be written against it.

Agreed upon design

  • Reintroduce first_name only. The existing name column stays and doubles as the last name when the feature is enabled. We do not reintroduce lastname.
  • Control the feature with a Spree::Config preference that defaults to the current unified approach. Stores that continue to use a single name field must see no change in behaviour at all.
  • first_name is optional by default. Stores can add a validation to require if need be, but let's all remember the Falsehoods Programmers Believe About Names.
  • If a store enables the flag, existing name values are left untouched and first_name is simply empty until filled in.
  • Backwards compatible for existing stores. The firstname column still exists in the schema. Whether we reuse it (and un-ignore it) or add a new first_name column can be decided in the PR, but any change must not require action from stores that leave the flag off.

Out of scope

  • Any data migration between single and split names. Stores that switch modes are responsible for their own data.

Related

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions