Back to Medusa

validateShippingOption - Fulfillment Module Reference

www/apps/resources/references/fulfillment/IFulfillmentModuleService/methods/fulfillment.IFulfillmentModuleService.validateShippingOption/page.mdx

2.14.21.6 KB
Original Source

import { TypeList } from "docs-ui"

validateShippingOption - Fulfillment Module Reference

This documentation provides a reference to the validateShippingOption method. This belongs to the Fulfillment Module.

<Note>

You should only use this methods when implementing complex customizations. For common cases, check out available workflows instead.

</Note>

This method checks whether a shipping option can be used for a specified context.

Example

ts
const isValid =
  await fulfillmentModuleService.validateShippingOption(
    "so_123",
    {
      customer_group: "cg_vipgroup",
    }
  )

Parameters

<TypeList types={[{"name":"shippingOptionId","type":"string","description":"The shipping option's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"context","type":"Record<string, unknown>","description":"The context to check.","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateShippingOption"/>

Returns

<TypeList types={[{"name":"Promise","type":"Promise<boolean>","optional":false,"defaultValue":"","description":"Whether the shipping option is valid for the specified context.","expandable":false,"children":[{"name":"boolean","type":"boolean","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="validateShippingOption"/>