Headless Redirect After Checkout

Hi,

I have a custom headless store using Next.js and Vercel for the frontend and Shopify for the backend. I’m trying to figure out the best way to redirect users back to my custom store after they complete checkout on Shopify.

I’ve explored two solutions but ran into issues with both:

1. Redirecting Shopify Traffic to My Custom Domain

I currently redirect my-store.shopify.com traffic to my-custom.domain.com. This works except for /cart and /checkout, which I need to keep on Shopify for checkout.

  • Is there a way to prevent the redirect for just these pages so /cart and /checkout remain on Shopify while everything else redirects?
  • ChatGPT mentioned there’s a redirect for checkout pages, but I can’t find it—does it exist?
  • Alternatively, can I handle the entire checkout process (payment, order creation, email sending) purely via GraphQL API?

2. Updating “Go to Store” URLs in Emails and Checkout

I’ve manually updated the “Go to Store” URLs in email templates via Liquid. However, I can’t modify the checkout page links.

  • I’ve read about using JavaScript on the checkout page, but that seems deprecated—am I missing something?
  • Is there an app that can help with this, or another way to control where users are redirected post-checkout?

Would appreciate any insights or recommendations. Thanks in advance!