Hello,
So i need to redirect my user from the thank you page (using an extension target of purchase.thank-you.block.render) to a custom backend call when they click on a button, how can i achieve this?
Hello,
So i need to redirect my user from the thank you page (using an extension target of purchase.thank-you.block.render) to a custom backend call when they click on a button, how can i achieve this?
Hi @tomasrsd
Ah, I do have an idea on this.
But first, you cannot use standard JavaScript commands like window.location to redirect users because Shopify Checkout Extensions run in a secure sandbox that blocks access to the window object.
The most simple solution is to use the Link component from the Shopify UI Extensions library. Since standard Buttons cannot trigger navigation, you must render a Link element that points to your backend URL. You can style this link to look more prominent, but it must remain a link element.
Hope this helps!
Hello @tomasrsd ,
You cannot directly redirect the user automatically from the Thank You page or freely navigate them to arbitrary URLs. However, you can redirect them when they click a button, with some constraints.
Using purchase.thank-you.block.render
You cannot
You can
Flow
Aa dam it, okay that might work as temporary solution, thank you!