OrderReturns container
The OrderReturns
container displays the list of returns associated with a specific order. Each return is presented with relevant details, such as return status and associated items. If no returns have been created for the order, the container is not rendered, ensuring that the interface remains clean and free of unnecessary placeholders.
OrderReturns container
Configurations
The OrderReturns
container provides the following configuration options:
Example
The following example demonstrates how to render the OrderReturns
container:
export default async function decorate(block) { const isAuthenticated = checkIsAuthenticated(); const returnDetailsPath = isAuthenticated ? CUSTOMER_RETURN_DETAILS_PATH : RETURN_DETAILS_PATH;
await orderRenderer.render(OrderReturns, { routeTracking: ({ carrier, number }) => { if (carrier?.toLowerCase() === 'ups') { return `${UPS_TRACKING_URL}?tracknum=${number}`; } return ''; }, routeReturnDetails: ({ orderNumber, returnNumber, token }) => { const { searchParams } = new URL(window.location.href); const orderRefFromUrl = searchParams.get('orderRef'); const newOrderRef = isAuthenticated ? orderNumber : token;
const encodedOrderRef = encodeURIComponent(orderRefFromUrl || newOrderRef);
return `${returnDetailsPath}?orderRef=${encodedOrderRef}&returnRef=${returnNumber}`; }, routeProductDetails: (productData) => (productData ? `/products/${productData.product.urlKey}/${productData.product.sku}` : '#'), })(block);}