AdminShippingProfilesResource
This class is used to send requests to Admin Shipping Profile API Routes. All its method
are available in the JS Client under the medusa.admin.shippingProfiles
property.
All methods in this class require authentication.
A shipping profile is used to group products that can be shipped in the same manner. They are created by the admin and they're not associated with a fulfillment provider.
Related Guide: Shipping Profile architecture.
Methods
create
Create a shipping profile.
Example
import { ShippingProfileType } from "@medusajs/medusa"
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.shippingProfiles.create({
name: "Large Products",
type: ShippingProfileType.DEFAULT
})
.then(({ shipping_profile }) => {
console.log(shipping_profile.id);
})
Parameters
The shipping profile to create.
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromise
ResponsePromise<AdminShippingProfilesRes>RequiredResolves to the shipping profile's details.
ResponsePromise
ResponsePromise<AdminShippingProfilesRes>Requiredupdate
Update a shipping profile's details.
Example
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.shippingProfiles.update(shippingProfileId, {
name: 'Large Products'
})
.then(({ shipping_profile }) => {
console.log(shipping_profile.id);
})
Parameters
id
stringRequiredThe shipping profile's ID.
The attributes to update in the shipping profile.
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromise
ResponsePromise<AdminShippingProfilesRes>RequiredResolves to the shipping profile's details.
ResponsePromise
ResponsePromise<AdminShippingProfilesRes>Requireddelete
Delete a shipping profile. Associated shipping options are deleted as well.
Example
Parameters
id
stringRequiredThe shipping profile's ID.
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromise
ResponsePromise<DeleteResponse>RequiredResolves to the deletion operation's details.
ResponsePromise
ResponsePromise<DeleteResponse>Requiredretrieve
Retrieve a shipping profile's details.
Example
Parameters
id
stringRequiredThe shipping profile's ID.
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromise
ResponsePromise<AdminShippingProfilesRes>RequiredResolves to the shipping profile's details.
ResponsePromise
ResponsePromise<AdminShippingProfilesRes>Requiredlist
Retrieve a list of shipping profiles.
Example
Parameters
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromise
ResponsePromise<AdminShippingProfilesListRes>RequiredResolves to the list of shipping profiles.
ResponsePromise
ResponsePromise<AdminShippingProfilesListRes>RequiredWas this section helpful?