Skip to main content
Skip to main content

Return Reasons

Queries listed here are used to send requests to the Store Return Reason API Routes.

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

Queries

useReturnReasons

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

Example

import React from "react"
import { useReturnReasons } from "medusa-react"

const ReturnReasons = () => {
const {
return_reasons,
isLoading
} = useReturnReasons()

return (
<div>
{isLoading && <span>Loading...</span>}
{return_reasons?.length && (
<ul>
{return_reasons.map((returnReason) => (
<li key={returnReason.id}>
{returnReason.label}
</li>
))}
</ul>
)}
</div>
)
}

export default ReturnReasons

Query Returned Data

return_reasonsReturnReason[]Required
An array of return reasons details.

useReturnReason

This hook retrieves a Return Reason's details.

Example

import React from "react"
import { useReturnReason } from "medusa-react"

type Props = {
returnReasonId: string
}

const ReturnReason = ({ returnReasonId }: Props) => {
const {
return_reason,
isLoading
} = useReturnReason(
returnReasonId
)

return (
<div>
{isLoading && <span>Loading...</span>}
{return_reason && <span>{return_reason.label}</span>}
</div>
)
}

export default ReturnReason

Hook Parameters

idstringRequired
The return reason's ID.

Query Returned Data

return_reasonReturnReasonRequired
Return reason details.
Was this section helpful?