Shipping Rate Functions
Ashipping_rate function returns extra shipping options for the customer to
pick at checkout. They render under the merchant’s configured shipping
zones with your appName attribution and the customer can select them
exactly like a built-in rate.
Runs at both cart verification (cart preview) and order placement for
parity. The customer’s selection is sent back to the order as
payload.customShippingRate.
How It Works
Function Manifest
Input Schema
All prices are in display currency units, not minor units (cents).
price: 19.99 means ₹19.99 / $19.99 — return your shipping prices the
same way.Output Schema
Pickup variants
Returnkind: 'local_pickup' when the customer collects from a store
location. Set pickup.location_id to the warehouse/store gid. The
checkout renders a “Local pickup” label and shows the address.
Return kind: 'pickup_point' when handing off to a third-party network
(parcel lockers, retail partners). Set pickup.provider to the network
name. The checkout renders “Pickup point — <provider>” and shows the
address and pickup window.
customShippingRates.
The cart UI groups them by appId so a single app’s rates appear under a
shared “Powered by <appName>” header.
Examples
Free shipping above a threshold
Zone-based pricing
Third-party carrier proxy
How it renders in the UI
customShippingRate at order placement; the
backend uses that price for the order total instead of the zone price.
Best Practices
Keep currency consistent
Keep currency consistent
Return
price in the same currency the cart is using (input.cart.currency).
Mismatched currencies log a warning and the rate may be applied without
FX conversion.Return early when destination is unknown
Return early when destination is unknown
On early cart-verification calls before the customer has typed their
address,
destination.country may be empty. Return { rates: [] } in
that case to avoid surfacing a wrong rate.Provide fallbacks for carrier API outages
Provide fallbacks for carrier API outages
Apps that proxy to carrier APIs should keep a static “best-guess” rate
available. If your function throws or returns no rates, the customer
only sees the merchant’s zones.
Test against the real checkout
Test against the real checkout
Drive
/checkout on a development store with a headless browser and
confirm your rate appears under the “Powered by <appName>” header.
JSON-only tests are not proof — only the rendered radio is.See Also
- Delivery Customization Functions — rename/hide/reorder existing shipping zones (don’t add new ones).
- Cart Transform Functions — per-line price changes; runs before shipping rate calculation.