solidusio / solidusio/solidus

Add optional `first_name` to `Spree::Address` behind a configuration flag

Open
#6,633 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

changelog:solidus_core
Dominant language
Ruby
Stars
5.3k
Forks
1.4k
Avg merge
1d 22h
Merged PRs (30d)
62

Description

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

  • #6159 (previous attempt, closed in favour of this issue)
  • #6110 (compliance issue that motivated it)
  • #3234 (original RFC to remove firstname/lastname)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Spree::Address and Spree::Config implementations, then inspect the existing schema and related tests around address names. Implement the agreed configuration flag without changing the default behavior; with the flag enabled, first_name should be optional while existing name values remain untouched, and stores with the flag off should require no action.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
backend, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.