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.updateActionItem("order_123", "action_123", {
quantity: 2,
})
.then(({ draft_order_preview }) => {
console.log(draft_order_preview)
})Update a new item that was added to a draft order edit by the ID of the item’s ITEM_ADD action.
Every item 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.updateActionItem("order_123", "action_123", {
quantity: 2,
})
.then(({ draft_order_preview }) => {
console.log(draft_order_preview)
})Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The draft order's ID.
The ID of the item's ITEM_ADD action.
OK