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.product.batchVariantInventoryItems(
"prod_123",
{
create: [
{
inventory_item_id: "iitem_123",
variant_id: "variant_123",
required_quantity: 10
}
],
update: [
{
inventory_item_id: "iitem_1234",
variant_id: "variant_1234",
required_quantity: 20
}
],
delete: [
{
inventory_item_id: "iitem_321",
variant_id: "variant_321"
}
]
}
)
.then(({ created, updated, deleted }) => {
console.log(created, updated, deleted)
}){
"created": {
"Product": {
"variant_id": "<string>"
},
"Inventory": {
"inventory_item_id": "<string>"
}
},
"updated": {
"Product": {
"variant_id": "<string>"
},
"Inventory": {
"inventory_item_id": "<string>"
}
},
"deleted": {
"Product": {
"variant_id": "<string>"
},
"Inventory": {
"inventory_item_id": "<string>"
}
}
}Manage a product’s variant’s inventoris to associate them with inventory items, update their inventory items, or delete their association with inventory items.
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.product.batchVariantInventoryItems(
"prod_123",
{
create: [
{
inventory_item_id: "iitem_123",
variant_id: "variant_123",
required_quantity: 10
}
],
update: [
{
inventory_item_id: "iitem_1234",
variant_id: "variant_1234",
required_quantity: 20
}
],
delete: [
{
inventory_item_id: "iitem_321",
variant_id: "variant_321"
}
]
}
)
.then(({ created, updated, deleted }) => {
console.log(created, updated, deleted)
}){
"created": {
"Product": {
"variant_id": "<string>"
},
"Inventory": {
"inventory_item_id": "<string>"
}
},
"updated": {
"Product": {
"variant_id": "<string>"
},
"Inventory": {
"inventory_item_id": "<string>"
}
},
"deleted": {
"Product": {
"variant_id": "<string>"
},
"Inventory": {
"inventory_item_id": "<string>"
}
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The product's ID.
The product variant inventories to manage.
The The associations to create between product variants and inventory items.
Show child attributes
The product variants to update their association with inventory items.
Show child attributes
The product variants to delete their association with inventory items.
Show child attributes
OK
The created, updated, and deleted associations between variants and inventory items.
The details of an association between a product variant and an inventory item.
Show child attributes
The details of an association between a product variant and an inventory item.
Show child attributes
The details of an association between a product variant and an inventory item.
Show child attributes