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.store.update("store_123", {
name: "My Store",
})
.then(({ store }) => {
console.log(store)
}){
"store": {
"id": "<string>",
"name": "<string>",
"supported_currencies": [
{
"id": "<string>",
"currency_code": "usd",
"store_id": "<string>",
"is_default": true,
"currency": {
"code": "usd",
"symbol": "$",
"symbol_native": "$",
"name": "<string>",
"decimal_digits": 123,
"rounding": 123,
"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"
}
],
"default_sales_channel_id": "<string>",
"default_region_id": "<string>",
"default_location_id": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Update a store’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.store.update("store_123", {
name: "My Store",
})
.then(({ store }) => {
console.log(store)
}){
"store": {
"id": "<string>",
"name": "<string>",
"supported_currencies": [
{
"id": "<string>",
"currency_code": "usd",
"store_id": "<string>",
"is_default": true,
"currency": {
"code": "usd",
"symbol": "$",
"symbol_native": "$",
"name": "<string>",
"decimal_digits": 123,
"rounding": 123,
"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"
}
],
"default_sales_channel_id": "<string>",
"default_region_id": "<string>",
"default_location_id": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The store'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 properties to update in a store.
The store's name.
The store's supported currencies.
The ID of the default sales channel in the store.
The ID of the default region in the store.
The ID of the default stock location in the store.
The store's metadata, can hold custom key-value pairs.
OK
The store's details.
The store's details.
Show child attributes
The store's ID.
The store's name.
The store's supported currencies.
Show child attributes
The currency's ID.
The currency's code.
"usd"
The ID of the store this currency belongs to.
Whether this currency is the default in the store.
The currency's currencies.
Show child attributes
The currency's code.
"usd"
The currency's symbol.
"$"
The currency's native symbol, if different than the symbol.
"$"
The currency's name.
The number of digits after the decimal for prices in this currency.
The rounding percision applied on prices in this currency.
The currency's creation date.
The currency's update date.
The currency's deletion date.
The date the currency was created.
The date the currency was updated.
The date the currency was deleted.
The ID of the sales channel used by default in the store.
The ID of the region used by default in the store.
The ID of the stock location used by default in the store.
The store's metadata, can hold custom key-value pairs.
The date the store was created.
The date the store was updated.