Skip to content

feat(core,starter): start checkout on the shop's country - #135

Merged
cavewebs merged 1 commit into
emdashCommerce:mainfrom
FIKANOVA:feat/shop-country
Dec 3, 2026
Merged

cavewebs merged 1 commit into
emdashCommerce:mainfrom
FIKANOVA:feat/shop-country

Conversation

@moset15

@moset15 moset15 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Checkout's country field always starts on US (value="US" in HostedCheckoutForm and in the starter's embedded form), and core has no setting for where the shop is based. A shopper on a shop outside the US changes it on every order.

#103 (now carried in #107) works around the same gap in its payout form by guessing the country from the default currency, and mentions a shop-country setting as a follow-up. Once both land, that form can start from this setting.

Part of the roadmap in #108.

Behaviour

  • Before: the ship-to country starts on US; a digital order's country starts empty.
  • After, with the setting: both start on the shop's country. Customers can still change it.
  • Without the setting nothing changes.

Changes

  • New optional setting storeCountry in settings/schema.ts: checked against core's country list (isValidCountryCode), trimmed and upper-cased. A country name or an unknown code is refused; null clears it.
  • Settings → Store → Shop country: a searchable country picker (the kit's Combobox with countryOptions()) above the currency fields. The card's description now mentions it.
  • HostedCheckoutForm: a new optional defaultCountry prop. The ship-to country starts on it (else US), and a digital order's country is prefilled with it (else empty).
  • Starter: reads the setting and passes it to the hosted form, and to the embedded form's shipping and billing country.
  • Changeset: minor for core (a new setting and prop), patch for the starter.

No change to routes/checkout.ts or to currencies.

Tests

packages/core/test/store-country.test.ts:

  • through the real admin/settings route: saves " ke " as KE and returns it; can be cleared with null; is null on a new shop; refuses "Kenya", "XX" and a number with a 400 naming the field;
  • source checks on both forms' country inputs and the starter's wiring.

Five of the six fail without the change (the refusal test passes either way, since an unknown key is refused too). Full suite: core 370 (364 before), paystack 105, lite 144, registry-setup 5, all passing. tsc --noEmit passes for core, astro check for the starter, Biome is clean on the new and changed lines; bun.lock is unchanged.

Review points

Next to #122: both add props near the top of HostedCheckoutForm.astro. If #122 merges first I'll rebase this; the change itself doesn't overlap.

Checkout's country field always started on US. A new optional
storeCountry setting (Settings → Store → Shop country) says where the
shop is based, and HostedCheckoutForm takes a matching defaultCountry
prop. The starter passes the setting to the hosted form and its
embedded Stripe form. Without the setting nothing changes, and null
clears it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cavewebs
cavewebs merged commit 92968a7 into emdashCommerce:main Dec 3, 2026
11 checks passed
@moset15
moset15 deleted the feat/shop-country branch December 6, 2026 01:36
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.

2 participants