import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.draftOrder.removeShippingMethod("order_123", "action_123")
.then(({ draft_order_preview }) => {
console.log(draft_order_preview)
})Remove a shipping method that was added to a draft order edit using the ID of the method’s SHIPPING_ADD action.
Every shipping method has an actions property, whose value is an array of actions. You can check the action’s name using its action property, and use the value of the id property.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.draftOrder.removeShippingMethod("order_123", "action_123")
.then(({ draft_order_preview }) => {
console.log(draft_order_preview)
})