Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Prefill payment method Name from provider label on select
Damian Legawiec4434d8ae993a
diff --git a/packages/admin/src/routes/_authenticated/$storeId/settings/payment-methods.tsx b/packages/admin/src/routes/_authenticated/$storeId/settings/payment-methods.tsxindex 4b733464fd..a23ac72a92 100644--- a/packages/admin/src/routes/_authenticated/$storeId/settings/payment-methods.tsx+++ b/packages/admin/src/routes/_authenticated/$storeId/settings/payment-methods.tsx@@ -207,7 +207,21 @@ function CreatePaymentMethodSheet({name="type"control={form.control}render={({ field }) => (- <Select value={field.value} onValueChange={field.onChange}>+ <Select+ value={field.value}+ onValueChange={(next) => {+ field.onChange(next)+ // Prefill the Name field with the provider's label+ // — but only if the admin hasn't typed something+ // themselves yet. `dirtyFields.name` is true after+ // any keystroke in the name input, so we leave it+ // alone in that case.+ const label = providerTypes.find((t) => t.type === next)?.label+ if (label && !form.formState.dirtyFields.name) {+ form.setValue('name', label, { shouldDirty: false })+ }+ }}+ ><SelectTrigger id="type" aria-invalid={!!form.formState.errors.type}><SelectValue placeholder={loadingTypes ? 'Loading…' : 'Select a provider'}>{(value) =>