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 user 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.
customHeadersRecord<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromiseResponsePromise<AdminShippingProfilesRes>RequiredResolves to the shipping profile's details.
ResponsePromiseResponsePromise<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
idstringRequiredThe shipping profile's ID.
The attributes to update in the shipping profile.
customHeadersRecord<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromiseResponsePromise<AdminShippingProfilesRes>RequiredResolves to the shipping profile's details.
ResponsePromiseResponsePromise<AdminShippingProfilesRes>Requireddelete
Delete a shipping profile. Associated shipping options are deleted as well.
Example
Parameters
idstringRequiredThe shipping profile's ID.
customHeadersRecord<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromiseResponsePromise<DeleteResponse>RequiredResolves to the deletion operation's details.
ResponsePromiseResponsePromise<DeleteResponse>Requiredretrieve
Retrieve a shipping profile's details.
Example
Parameters
idstringRequiredThe shipping profile's ID.
customHeadersRecord<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromiseResponsePromise<AdminShippingProfilesRes>RequiredResolves to the shipping profile's details.
ResponsePromiseResponsePromise<AdminShippingProfilesRes>Requiredlist
Retrieve a list of shipping profiles.
Example
Parameters
customHeadersRecord<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
ResponsePromiseResponsePromise<AdminShippingProfilesListRes>RequiredResolves to the list of shipping profiles.
ResponsePromiseResponsePromise<AdminShippingProfilesListRes>RequiredWas this section helpful?