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.beginEdit("order_123")
.then(({ draft_order_preview }) => {
console.log(draft_order_preview)
})Create an edit on a draft order. This will allow you to make changes to the draft order’s items, shipping methods, or promotions. Once you’ve made the necessar changes, you can later either request the edit (which requires a confirmation from the customer), or force-confirm the edit.
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.beginEdit("order_123")
.then(({ draft_order_preview }) => {
console.log(draft_order_preview)
})