Repository navigation
feat(core,starter): start checkout on the shop's country - #135
Merged
Merged
Conversation
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>
This was referenced Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Checkout's country field always starts on
US(value="US"inHostedCheckoutFormand 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
US; a digital order's country starts empty.Changes
storeCountryinsettings/schema.ts: checked against core's country list (isValidCountryCode), trimmed and upper-cased. A country name or an unknown code is refused;nullclears it.ComboboxwithcountryOptions()) above the currency fields. The card's description now mentions it.HostedCheckoutForm: a new optionaldefaultCountryprop. The ship-to country starts on it (elseUS), and a digital order's country is prefilled with it (else empty).No change to
routes/checkout.tsor to currencies.Tests
packages/core/test/store-country.test.ts:admin/settingsroute: saves" ke "asKEand returns it; can be cleared withnull; isnullon a new shop; refuses"Kenya","XX"and a number with a 400 naming the field;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 --noEmitpasses for core,astro checkfor the starter, Biome is clean on the new and changed lines;bun.lockis unchanged.Review points
SettingsPage.tsxonmain; they're left as they are.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.