GET
/
store
/
shipping-options
import Medusa from "@medusajs/js-sdk"

let MEDUSA_BACKEND_URL = "http://localhost:9000"

if (process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL) {
  MEDUSA_BACKEND_URL = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL
}

export const sdk = new Medusa({
  baseUrl: MEDUSA_BACKEND_URL,
  debug: process.env.NODE_ENV === "development",
  publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})

sdk.store.fulfillment.listCartOptions({
  cart_id: "cart_123"
})
.then(({ shipping_options }) => {
  console.log(shipping_options)
})
{
"shipping_options": [
{
"id": "<string>",
"name": "<string>",
"price_type": "flat",
"service_zone_id": "<string>",
"provider_id": "<string>",
"provider": {
"id": "<string>",
"is_enabled": true
},
"type": {
"id": "<string>",
"label": "<string>",
"description": "<string>",
"code": "<string>"
},
"shipping_profile_id": "<string>",
"amount": 123,
"data": {},
"prices": [
{
"id": "<string>",
"currency_code": "usd",
"amount": 123,
"min_quantity": 123,
"max_quantity": 123,
"price_rules": [
{
"id": "<string>",
"attribute": "<string>",
"operator": "gt",
"value": "<string>"
}
]
}
],
"calculated_price": {
"id": "<string>",
"is_calculated_price_price_list": true,
"is_calculated_price_tax_inclusive": true,
"calculated_amount": 123,
"calculated_amount_with_tax": 123,
"calculated_amount_without_tax": 123,
"is_original_price_price_list": true,
"is_original_price_tax_inclusive": true,
"original_amount": 123,
"currency_code": "<string>",
"calculated_price": {
"id": "<string>",
"price_list_id": "<string>",
"price_list_type": "<string>",
"min_quantity": 123,
"max_quantity": 123
},
"original_price": {
"id": "<string>",
"price_list_id": "<string>",
"price_list_type": "<string>",
"min_quantity": 123,
"max_quantity": 123
},
"original_amount_with_tax": 123,
"original_amount_without_tax": 123
},
"insufficient_inventory": true
}
]
}

Headers

x-publishable-api-key
string
required

Publishable API Key created in the Medusa Admin.

Query Parameters

fields
string

Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.

offset
number

The number of items to skip when retrieving a list.

limit
number

Limit the number of items returned in the list.

order
string

The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.

cart_id
string
required

The ID of the cart to retrieve its shipping options.

$and
$and · object[]

Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.

$or
$or · object[]

Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.

is_return
boolean

Whether the shipping option can be used for returns.

Response

200
application/json

OK

The shipping option's details.