Skip to main content
Skip to main content

ReturnReasonsResource

This class is used to send requests to Store Return Reason API Routes. All its method are available in the JS Client under the medusa.returnReasons property.

Return reasons are key-value pairs that are used to specify why an order return is being created.

Methods

list

Retrieve a list of Return Reasons. This is useful when implementing a Create Return flow in the storefront.

Example

import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.returnReasons.list()
.then(({ return_reasons }) => {
console.log(return_reasons.length);
})

Parameters

customHeadersRecord<string, any>Required
Custom headers to attach to the request.

Default: {}

Returns

ResponsePromiseResponsePromise<StoreReturnReasonsListRes>Required
Resolves to the list of return reasons.

retrieve

Retrieve a Return Reason's details.

Example

import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.returnReasons.retrieve(reasonId)
.then(({ return_reason }) => {
console.log(return_reason.id);
})

Parameters

idstringRequired
The ID of the return reason.
customHeadersRecord<string, any>Required
Custom headers to attach to the request.

Default: {}

Returns

ResponsePromiseResponsePromise<StoreReturnReasonsRes>Required
Resolves to the return reason's details.
Was this section helpful?