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.priceList.update("plist_123", {
title: "My Price List",
})
.then(({ price_list }) => {
console.log(price_list)
}){
"price_list": {
"id": "<string>",
"title": "<string>",
"description": "<string>",
"rules": {},
"starts_at": "<string>",
"ends_at": "<string>",
"status": "draft",
"type": "sale",
"prices": [
{
"variant_id": "<string>",
"rules": {},
"id": "<string>",
"title": "<string>",
"currency_code": "usd",
"amount": 123,
"raw_amount": {},
"min_quantity": 123,
"max_quantity": 123,
"price_set_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
}Update a price list’s details.
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.priceList.update("plist_123", {
title: "My Price List",
})
.then(({ price_list }) => {
console.log(price_list)
}){
"price_list": {
"id": "<string>",
"title": "<string>",
"description": "<string>",
"rules": {},
"starts_at": "<string>",
"ends_at": "<string>",
"status": "draft",
"type": "sale",
"prices": [
{
"variant_id": "<string>",
"rules": {},
"id": "<string>",
"title": "<string>",
"currency_code": "usd",
"amount": 123,
"raw_amount": {},
"min_quantity": 123,
"max_quantity": 123,
"price_set_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The price list's ID.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
the details to update in a price list.
The price list's title.
The price list's description.
The date the price list starts.
The date the price list ends.
The price list's status.
active, draft The price list's type.
sale, override The price list's rules.
{ "customer_group_id": ["cusgrp_123"] }OK
The price list's details.
The price list's details.
Show child attributes
The price list's ID.
The price list's title.
The price list's description.
The price list's rules.
The date the price list starts.
The date the price list ends.
The price list's status.
draft, active The price list's type.
sale, override The price list's prices.
Show child attributes
The ID of the product variant this price list is for.
The price's rules.
The price's ID.
The price's title.
The price's currency code.
"usd"
The price's amount.
The price's raw amount.
The minimum quantity that must be available in the cart for the price to be applied.
The maximum quantity allowed to be available in the cart for the price to be applied.
The ID of the price set this price belongs to.
The date the price was created.
The date the price was updated.
The date the price was deleted.
The date the price list was created.
The date the price list was updated.
The date the price list was deleted.