diff --git a/blocks/commerce-order-returns/commerce-order-returns.js b/blocks/commerce-order-returns/commerce-order-returns.js index 34db43d3e3..1f2658f469 100644 --- a/blocks/commerce-order-returns/commerce-order-returns.js +++ b/blocks/commerce-order-returns/commerce-order-returns.js @@ -34,6 +34,6 @@ export default async function decorate(block) { return `${returnDetailsPath}?orderRef=${encodedOrderRef}&returnRef=${returnNumber}`; }, - routeProductDetails: (productData) => (productData ? `/products/${productData.product.urlKey}/${productData.product.sku}` : '#'), + routeProductDetails: (productData) => (productData?.product ? `/products/${productData.product.urlKey}/${productData.product.sku}` : '#'), })(block); } diff --git a/blocks/commerce-orders-list/commerce-orders-list.js b/blocks/commerce-orders-list/commerce-orders-list.js index 8b0fb62af3..f84066106c 100644 --- a/blocks/commerce-orders-list/commerce-orders-list.js +++ b/blocks/commerce-orders-list/commerce-orders-list.js @@ -32,7 +32,7 @@ export default async function decorate(block) { routeOrdersList: () => CUSTOMER_ORDERS_PATH, routeOrderDetails: (orderNumber) => `${CUSTOMER_ORDER_DETAILS_PATH}?orderRef=${orderNumber}`, routeReturnDetails: ({ orderNumber, returnNumber }) => `${CUSTOMER_RETURN_DETAILS_PATH}?orderRef=${orderNumber}&returnRef=${returnNumber}`, - routeOrderProduct: (productData) => (productData ? `/products/${productData.product.urlKey}/${productData.product.sku}` : '#'), + routeOrderProduct: (productData) => (productData?.product ? `/products/${productData.product.urlKey}/${productData.product.sku}` : '#'), })(block); } } diff --git a/blocks/commerce-returns-list/commerce-returns-list.js b/blocks/commerce-returns-list/commerce-returns-list.js index d71f9bb905..3a18d05424 100644 --- a/blocks/commerce-returns-list/commerce-returns-list.js +++ b/blocks/commerce-returns-list/commerce-returns-list.js @@ -34,7 +34,7 @@ export default async function decorate(block) { routeReturnDetails: ({ orderNumber, returnNumber }) => `${CUSTOMER_RETURN_DETAILS_PATH}?orderRef=${orderNumber}&returnRef=${returnNumber}`, routeOrderDetails: ({ orderNumber }) => `${CUSTOMER_ORDER_DETAILS_PATH}?orderRef=${orderNumber}`, routeReturnsList: () => CUSTOMER_RETURNS_PATH, - routeProductDetails: (productData) => (productData ? `/products/${productData.product.urlKey}/${productData.product.sku}` : '#'), + routeProductDetails: (productData) => (productData?.product ? `/products/${productData.product.urlKey}/${productData.product.sku}` : '#'), })(block); } }