UNPKG

@medusajs/core-flows

Version:

Set of workflow definitions for Medusa

62 lines 2.23 kB
import { WorkflowData } from "@medusajs/framework/workflows-sdk"; /** * The data to add a shipping method to a cart. */ export interface AddShippingMethodToCartWorkflowInput { /** * The ID of the cart to add the shipping method to. */ cart_id: string; /** * The shipping options to create the shipping methods from and add to the cart. */ options: { /** * The ID of the shipping option. */ id: string; /** * Custom data useful for the fulfillment provider processing the shipping option or method. * * Learn more in [this documentation](https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#data-property). */ data?: Record<string, unknown>; }[]; } export declare const addShippingMethodToCartWorkflowId = "add-shipping-method-to-cart"; /** * This workflow adds a shipping method to a cart. It's executed by the * [Add Shipping Method Store API Route](https://docs.medusajs.com/api/store#carts_postcartsidshippingmethods). * * You can use this workflow within your own customizations or custom workflows, allowing you to wrap custom logic around adding a shipping method to the cart. * * @example * const { result } = await addShippingMethodToCartWorkflow(container) * .run({ * input: { * cart_id: "cart_123", * options: [ * { * id: "so_123", * }, * { * id: "so_124", * data: { * carrier_code: "fedex", * } * } * ] * } * }) * * @summary * * Add a shipping method to a cart. * * @property hooks.validate - This hook is executed before all operations. You can consume this hook to perform any custom validation. If validation fails, you can throw an error to stop the workflow execution. */ export declare const addShippingMethodToCartWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<AddShippingMethodToCartWorkflowInput, undefined, [import("@medusajs/framework/workflows-sdk").Hook<"validate", { input: WorkflowData<AddShippingMethodToCartWorkflowInput>; cart: any; }, unknown>]>; //# sourceMappingURL=add-shipping-method-to-cart.d.ts.map