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
Say what a carrier method costs, not who supplies it
Damian Legawiecf00b0dc6d1d3
diff --git a/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsx b/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsxindex 884487b3e9..afa273c9bd 100644--- a/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsx+++ b/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsx@@ -112,7 +112,11 @@ function useSelectedFulfillmentProvider(form: UseFormReturn<DeliveryMethodFormVa/*** One block of the method form. The form lives in a sheet, which is already a* bordered surface — nesting cards inside it stacks three borders around every- * field, so sections are separated by a rule and a heading instead.+ * field, so a rule separates each block instead.+ *+ * Most blocks carry no heading: their fields are labelled already, and+ * "Providers" above two selects both named "…provider" is a label for a label.+ * A title is for a block whose fields do not announce themselves.*/function FormSection({title,@@ -120,20 +124,24 @@ function FormSection({action,children,}: {- title: string+ title?: stringdescription?: stringaction?: React.ReactNodechildren: React.ReactNode}) {+ const heading = title || description || action+return (<section className="flex flex-col gap-4 border-t pt-6 first:border-t-0 first:pt-0">- <div className="flex items-start justify-between gap-2">- <div className="flex flex-col gap-0.5">- <h3 className="font-medium text-sm">{title}</h3>- {description && <p className="text-muted-foreground text-xs">{description}</p>}+ {heading && (+ <div className="flex items-start justify-between gap-2">+ <div className="flex flex-col gap-0.5">+ {title && <h3 className="font-medium text-sm">{title}</h3>}+ {description && <p className="text-muted-foreground text-xs">{description}</p>}+ </div>+ {action}</div>- {action}- </div>+ )}{children}</section>)@@ -179,20 +187,18 @@ export function DeliveryMethodFormCards({/*** What the customer is told about timing, and where a hand-entered tracking- * number points. Both are the merchant's own estimates on a method they- * price themselves; a carrier method gets these from the carrier, so they- * sit apart from the method's identity.+ * number points — both the merchant's own answers on a method they price+ * themselves. A carrier supplies an estimate with every rate and resolves+ * its own tracking links, so the whole section is hidden there.*/function DeliveryEstimateSection({ form }: { form: UseFormReturn<DeliveryMethodFormValues> }) {const { t } = useTranslation()const selectedRateProvider = useSelectedRateProvider(form)- const carrierPriced = selectedRateProvider?.uses_calculator === false++ if (selectedRateProvider?.uses_calculator === false) return nullreturn (- <FormSection- title={t('admin.delivery_methods.cards.estimate')}- description={carrierPriced ? t('admin.delivery_methods.estimate.carrier_hint') : undefined}- >+ <FormSection title={t('admin.delivery_methods.cards.estimate')}><div className="grid grid-cols-2 gap-3"><Field><FieldLabel htmlFor="estimated_transit_business_days_min">@@ -218,20 +224,16 @@ function DeliveryEstimateSection({ form }: { form: UseFormReturn<DeliveryMethodF</Field></div>- {/* A carrier provider resolves its own tracking links, so the template- would never be read on one of its fulfillments. */}- {!carrierPriced && (- <Field>- <FieldLabel htmlFor="tracking_url">- {t('admin.fields.delivery_method.tracking_url.label')}- </FieldLabel>- <Input- id="tracking_url"- placeholder="https://carrier.example/track?num=:tracking"- {...form.register('tracking_url')}- />- </Field>- )}+ <Field>+ <FieldLabel htmlFor="tracking_url">+ {t('admin.fields.delivery_method.tracking_url.label')}+ </FieldLabel>+ <Input+ id="tracking_url"+ placeholder="https://carrier.example/track?num=:tracking"+ {...form.register('tracking_url')}+ />+ </Field></FormSection>)}@@ -290,7 +292,7 @@ function GeneralCard({ form }: { form: UseFormReturn<DeliveryMethodFormValues> }const { errors } = form.formStatereturn (- <FormSection title={t('admin.delivery_methods.cards.general')}>+ <FormSection><>{errors.root?.message && (<p className="text-sm text-destructive" role="alert">@@ -554,7 +556,7 @@ function ProvidersCard({}, [carrierName, nameDirty, form])return (- <FormSection title={t('admin.delivery_methods.cards.providers')}>+ <FormSection><ProviderSelectFieldform={form}name="fulfillment_provider"@@ -1016,7 +1018,7 @@ function PricingCard({ form }: { form: UseFormReturn<DeliveryMethodFormValues> }]return (- <FormSection title={t('admin.delivery_methods.cards.pricing')}>+ <FormSection>{usesCalculator ? (<><Field>@@ -1149,7 +1151,7 @@ function ZoneCard({]return (- <FormSection title={t('admin.delivery_methods.cards.zone')}>+ <FormSection><Field><FieldLabel>{t('admin.fields.delivery_method.delivery_zone.label')}</FieldLabel><Controllerdiff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.jsonindex 23fa151809..f7dc864cd5 100644--- a/packages/dashboard/src/locales/ar.json+++ b/packages/dashboard/src/locales/ar.json@@ -470,14 +470,7 @@"delivery_methods": {"add_sheet_title": "طريقة توصيل جديدة","cards": {- "general": "عام",- "pricing": "التسعير",- "estimate": "تقدير التسليم",- "providers": "المزوّدون",- "zone": "المنطقة"- },- "estimate": {- "carrier_hint": "توفّر شركة الشحن تقديرها الخاص لكل سعر؛ وتُستخدم هذه القيم عند عدم توفّره."+ "estimate": "تقدير التسليم"},"carrier_services": {"add_service": "إضافة خدمة",@@ -532,7 +525,8 @@"weight_between": "{{min}}–{{max}} {{unit}}","weight_max": "أقل من {{max}} {{unit}}","weight_min": "{{min}} {{unit}} فأكثر"- }+ },+ "carrier_rates_hint": "تأتي الأسعار من {{name}} عند الدفع، ويتم تسعيرها مباشرةً لكل طلب."},"delivery_origin_groups": {"delete_confirm": {diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.jsonindex 7e764d90bb..c24c9c7a34 100644--- a/packages/dashboard/src/locales/de.json+++ b/packages/dashboard/src/locales/de.json@@ -470,14 +470,7 @@"delivery_methods": {"add_sheet_title": "Neue Versandart","cards": {- "general": "Allgemein",- "pricing": "Preisgestaltung",- "estimate": "Lieferschätzung",- "providers": "Anbieter",- "zone": "Zone"- },- "estimate": {- "carrier_hint": "Der Versanddienstleister liefert für jeden Tarif eine eigene Schätzung; diese Werte gelten, wenn er keine liefert."+ "estimate": "Lieferschätzung"},"carrier_services": {"add_service": "Service hinzufügen",@@ -532,7 +525,8 @@"weight_between": "{{min}}–{{max}} {{unit}}","weight_max": "Unter {{max}} {{unit}}","weight_min": "Ab {{min}} {{unit}}"- }+ },+ "carrier_rates_hint": "Die Preise kommen beim Checkout von {{name}} und werden für jede Bestellung live ermittelt."},"delivery_origin_groups": {"delete_confirm": {diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.jsonindex 4c9215ed8d..bbd9ac5340 100644--- a/packages/dashboard/src/locales/en.json+++ b/packages/dashboard/src/locales/en.json@@ -470,14 +470,7 @@"delivery_methods": {"add_sheet_title": "New delivery method","cards": {- "general": "General",- "pricing": "Pricing",- "estimate": "Delivery estimate",- "providers": "Providers",- "zone": "Zone"- },- "estimate": {- "carrier_hint": "The carrier supplies its own estimate for each rate; these apply when it does not."+ "estimate": "Delivery estimate"},"carrier_services": {"add_service": "Add service",@@ -532,7 +525,8 @@"weight_between": "{{min}}–{{max}}{{unit}}","weight_max": "Under {{max}}{{unit}}","weight_min": "{{min}}{{unit}} and up"- }+ },+ "carrier_rates_hint": "Prices come from {{name}} at checkout, quoted live for each order."},"delivery_origin_groups": {"delete_confirm": {diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.jsonindex 73cfb28046..1ae3d45c46 100644--- a/packages/dashboard/src/locales/fr.json+++ b/packages/dashboard/src/locales/fr.json@@ -470,14 +470,7 @@"delivery_methods": {"add_sheet_title": "Nouvelle méthode de livraison","cards": {- "general": "Général",- "pricing": "Tarification",- "estimate": "Estimation de livraison",- "providers": "Prestataires",- "zone": "Zone"- },- "estimate": {- "carrier_hint": "Le transporteur fournit sa propre estimation pour chaque tarif ; ces valeurs s'appliquent à défaut."+ "estimate": "Estimation de livraison"},"carrier_services": {"add_service": "Ajouter un service",@@ -532,7 +525,8 @@"weight_between": "{{min}}–{{max}} {{unit}}","weight_max": "Moins de {{max}} {{unit}}","weight_min": "À partir de {{min}} {{unit}}"- }+ },+ "carrier_rates_hint": "Les prix proviennent de {{name}} au paiement, calculés en direct pour chaque commande."},"delivery_origin_groups": {"delete_confirm": {diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.jsonindex 61e0978427..fd097f8739 100644--- a/packages/dashboard/src/locales/pl.json+++ b/packages/dashboard/src/locales/pl.json@@ -478,14 +478,7 @@"delivery_methods": {"add_sheet_title": "Nowa metoda dostawy","cards": {- "general": "Ogólne",- "pricing": "Ceny",- "estimate": "Szacowana dostawa",- "providers": "Dostawcy",- "zone": "Strefa"- },- "estimate": {- "carrier_hint": "Przewoźnik podaje własne szacunki dla każdej stawki; te wartości obowiązują, gdy ich nie poda."+ "estimate": "Szacowana dostawa"},"carrier_services": {"add_service": "Dodaj usługę",@@ -540,7 +533,8 @@"weight_between": "{{min}}–{{max}} {{unit}}","weight_max": "Poniżej {{max}} {{unit}}","weight_min": "Od {{min}} {{unit}}"- }+ },+ "carrier_rates_hint": "Ceny pochodzą z {{name}} przy składaniu zamówienia i są wyliczane na żywo dla każdego zamówienia."},"delivery_origin_groups": {"delete_confirm": {diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.jsonindex 9a036efa3d..3b06d885f4 100644--- a/packages/dashboard/src/locales/zh-CN.json+++ b/packages/dashboard/src/locales/zh-CN.json@@ -470,14 +470,7 @@"delivery_methods": {"add_sheet_title": "新建配送方式","cards": {- "general": "基本信息",- "pricing": "价格",- "estimate": "预计送达",- "providers": "服务商",- "zone": "区域"- },- "estimate": {- "carrier_hint": "承运商会为每个费率提供自己的预计时间;仅在其未提供时使用这些值。"+ "estimate": "预计送达"},"carrier_services": {"add_service": "添加服务",@@ -532,7 +525,8 @@"weight_between": "{{min}}–{{max}} {{unit}}","weight_max": "低于 {{max}} {{unit}}","weight_min": "{{min}} {{unit}} 及以上"- }+ },+ "carrier_rates_hint": "结账时由 {{name}} 提供价格,按每笔订单实时报价。"},"delivery_origin_groups": {"delete_confirm": {diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index.tsxindex 8d0e1c10d2..930840f583 100644--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index.tsx+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index.tsx@@ -1050,9 +1050,10 @@ function MethodList({const rateProvider = (rateProviders?.data ?? []).find((provider) => provider.type === method.rate_provider,)- // A carrier quotes each shipment live, so there is no one price to- // show — the carrier's name is the honest answer. Everything else is- // priced up front: an amount, or free when there is none.+ // A carrier quotes each shipment live, so this column answers what the+ // price IS rather than naming the provider — which the method is+ // usually named after anyway. Everything else is priced up front: an+ // amount, or free when there is none.//// A method carrying a rate provider absent from the registry (an// uninstalled gem, a disconnected integration) is still not@@ -1062,7 +1063,7 @@ function MethodList({: !!method.rate_provider && method.rate_provider !== defaultRateProviderconst amount = flatAmount(method.calculator_preferences)const price = carrierPriced- ? (rateProvider?.name ?? t('admin.delivery_methods.carrier_rates'))+ ? t('admin.delivery_methods.carrier_rates'): amount === null || amount === 0? t('admin.delivery_methods.free'): formatAmount(amount, defaultCurrency, i18n.language)@@ -1092,7 +1093,24 @@ function MethodList({{!method.storefront_visible && (<Badge variant="outline">{t('admin.delivery_profiles.detail.hidden_badge')}</Badge>)}- <span className="shrink-0 text-sm tabular-nums">{price}</span>+ {carrierPriced ? (+ <Tooltip>+ <TooltipTrigger+ render={+ <span className="shrink-0 cursor-default text-sm underline decoration-dotted underline-offset-2">+ {price}+ </span>+ }+ />+ <TooltipContent className="max-w-xs">+ {t('admin.delivery_methods.carrier_rates_hint', {+ name: rateProvider?.name ?? method.name,+ })}+ </TooltipContent>+ </Tooltip>+ ) : (+ <span className="shrink-0 text-sm tabular-nums">{price}</span>+ )}<RowActionsactions={[{