AdminReturnReasonsResource
This class is used to send requests to Admin Return Reason API Routes. All its method
are available in the JS Client under the medusa.admin.returnReasons
property.
All methods in this class require user authentication.
Return reasons are key-value pairs that are used to specify why an order return is being created. Admins can manage available return reasons, and they can be used by both admins and customers when creating a return.
Related Guide: How to manage return reasons.
Methods
create
Create a return reason.
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.returnReasons
.create({
label: "Damaged",
value: "damaged",
})
.then(({ return_reason }) => {
console.log(return_reason.id)
})
Parameters
The return reason to create.
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
Resolves to the return reason's details.
delete
Delete a return reason.
Example
Parameters
id
stringRequiredThe ID of the return reason.
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
Resolves to the deletion operation's details.
list
Retrieve a list of return reasons.
Example
Parameters
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
Resolves to the list of return reasons.
retrieve
Retrieve a return reason's details.
Example
Parameters
id
stringRequiredThe return reason's ID.
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
Resolves to the return reason's details.
update
Update a return reason's details.
Example
Parameters
id
stringRequiredThe return reason's ID.
The attributes to update in the return reason.
customHeaders
Record<string, any>RequiredCustom headers to attach to the request.
Default: {}
Returns
Resolves to the return reason's details.
Was this section helpful?