Skip to content

Create the US tax region when the onboarding address has no state - #367

Merged
ahamed merged 3 commits into
devfrom
ahamed/fix-onboarding-us-location
Oct 15, 2026
Merged

ahamed merged 3 commits into
devfrom
ahamed/fix-onboarding-us-location

Conversation

@ahamed

@ahamed ahamed commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Onboarding tax fix. A per-state country (US, Canada) got no tax region when the store address had no state, or a state the presets do not know. The wizard address is optional, so the merchant saw no zone in Settings > Tax. The region is now always built.
    • scope: home (US): the region lists no state until the merchant adds one. A state with no preset (for example Oregon) has no sales tax, so an empty region is correct.
    • scope: all (Canada): the region lists every province, without the home-state extra rate.
  • Per-worktree Docker stack. bin/dev-up picks free host ports once, saves them with WP_URL in .env, and runs docker compose up -d. bin/dev-urls prints the addresses. orca.yaml runs bin/dev-up for a new worktree and docker compose down -v when it is archived. The Vite origin and the PHPUnit DB host read the saved ports. Docs no longer hard-code the ports. Spec: openspec/changes/per-worktree-docker-ports/.

Behavior to know

A US store with no state has an enabled US zone with no states. DefaultTaxStrategy::get_rate() returns 0 for an address that matches no state, so US orders have no tax until the merchant adds a state. The US has no federal sales tax, and the presets have no rate to guess. A hint in the Tax settings UI is possible later but is not part of this PR.

Test plan

  • composer test:docker:integration -- --filter=StorePresetsTest
  • composer test:docker:integration -- --filter=LocalPresetSourceTest
  • Run onboarding with a US address and no state: a US zone with no states appears in Settings > Tax
  • Run onboarding with a Canadian address and no state: all provinces are listed
  • bin/dev-up in a second worktree starts a stack on different ports

I did not run the test suites for this PR. I did check the dev stack: a fresh volume installs WordPress, and the plugin migrates and seeds.

🤖 Generated with Claude Code

ahamed and others added 3 commits October 15, 2026 02:28
A per-state country (US, Canada) got no tax region when the store address
had no state, or a state the presets do not know. The wizard address is
optional, so the merchant saw no zone at all in Settings > Tax.

The region is now always built. With scope "home" (US) it lists no state
until the merchant adds one; a state with no preset, such as Oregon, has
no sales tax, so an empty region is correct. With scope "all" (Canada) it
lists every province, without the home-state extra rate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Every checkout used the fixed ports 20100-20102, so two worktrees could
not run at once. bin/dev-up now picks free host ports once, saves them
with WP_URL in .env, and runs docker compose up -d. bin/dev-urls prints
the addresses. orca.yaml runs bin/dev-up when Orca creates a worktree and
docker compose down -v when it archives one.

The Vite dev server origin and the PHPUnit database host read the saved
ports from .env. The README and docs no longer hard-code the ports.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The Vite port (5173) was fixed in vite.config.js and in
EnqueueAdminScripts, so only one worktree could run `npm run dev`.

- bin/dev-up saves VITE_PORT in .env: 5173 plus the offset of the nginx
  port from 20100. The nginx port is unique per stack, and the dev server
  is not running when bin/dev-up runs, so a free-port probe would not work.
- vite.config.js reads VITE_PORT with strictPort, because the plugin loads
  its scripts from that exact port.
- docker-compose.yml passes VITE_PORT to the php container, and
  docker/wp-config.php defines KECOM_VITE_DEV_SERVER from it.
  EnqueueAdminScripts reads that constant and falls back to 5173.
- bin/dev-urls prints the Vite address. README, .env.example and the
  per-worktree-docker-ports OpenSpec change are updated.

Lint and typecheck pass. Two dev servers at the same time are not tested.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ahamed
ahamed merged commit ad5c796 into dev Oct 15, 2026
6 checks passed
@ahamed
ahamed deleted the ahamed/fix-onboarding-us-location branch October 15, 2026 08:37
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.

1 participant