Skip to main content
Resolves the sellers behind the cart’s offers, finds their stock locations valid for the cart’s sales channel, and queries shipping options in those locations’ fulfillment sets with cart-scoped pricing. Each option carries its calculated amount, is_tax_inclusive, and an insufficient_inventory flag when the seller’s location can’t cover the cart quantities. Options are translated to the cart locale and returned keyed by seller ID. Triggered by GET /store/shipping-options.

Usage

import { listSellerShippingOptionsForCartWorkflow } from "@mercurjs/core/workflows"

const { result } = await listSellerShippingOptionsForCartWorkflow(container).run({
  input: { cart_id: "cart_123" },
})

Input

cart_id
string
required
The cart to list options for; must have sales_channel_id, region_id, and currency_code set.
is_return
boolean
List return shipping options instead; defaults to false.
enabled_in_store
boolean
Only options enabled in the storefront; defaults to true.
fields
string[]
Extra shipping-option fields to retrieve on top of the defaults.
additional_data
object
Custom data passed through to the workflow hooks.

Result

result
Record<string, ShippingOptionDTO[]>
Map of seller ID to that seller’s priced shipping options, each extended with amount, is_tax_inclusive, and insufficient_inventory.

Hooks

  • setPricingContext — runs with { cart, fulfillmentSetIds, additional_data }; return a record to merge into the price calculation context.
  • setShippingOptionsContext — runs with the same payload; return a record to merge into the shipping-option rule context.
listSellerShippingOptionsForCartWorkflow.hooks.setPricingContext(async ({ cart }) => {
  return { customer_tier: "vip" }
})