Skip to content

Added an online store order status route #540

Merged
blittle merged 6 commits into
2023-01from
jc-add-online-store-orders-route
Mar 13, 2023
Merged

Added an online store order status route #540
blittle merged 6 commits into
2023-01from
jc-add-online-store-orders-route

Conversation

@johncraigcole
Copy link
Copy Markdown
Contributor

Added a route to demonstrate redirecting an order status url back to the online store primary domain. If merchants had been live on the online store before launching a Hydrogen storefront, previous order status urls emailed to customers are likely using the root/apex domain that post launch in all likelihood is now resolving to the Hydrogen storefront.

I added an ErrorBoundary export in the event the shop object is null so that the user would be able to try again or would be able to navigate to another area of the storefront.

The final version of this order status redirect should be included in our Oxygen help here which currently only has the v1 version of handling this redirect.

@cartogram
Copy link
Copy Markdown
Contributor

@benjaminsehl this is a good candidate for auto generation via generate route.

cache: storefront.CacheLong(),
});
invariant(shop, 'Error redirecting to the order status URL');
return redirect(request.url.replace(origin, shop.primaryDomain.url));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a script we recommend merchants adopt in the online store to redirect users to the custom storefront. If that script isn't implemented correctly, this could create an infinite redirect. Maybe there's a way we could check the request referer to prevent a redirect?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brett, are you talking about a client side redirect in theme.liquid? If so, I don't believe the Shopify order status route uses theme.liquid for it's rendering.

Copy link
Copy Markdown
Contributor

@blittle blittle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, @benjaminsehl this is one of those kinda built in routes that we might want to make easier.

@blittle blittle merged commit 1421108 into 2023-01 Mar 13, 2023
@blittle blittle deleted the jc-add-online-store-orders-route branch March 13, 2023 21:25
@github-actions github-actions Bot mentioned this pull request Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants