I’m adding additional scripts to the order status page of Shopify’s admin interface under Settings > Checkout.
I’m writing JavaScript code like this:
<script type="text/javascript">
const url = window.location.href;
const pattern = /^https:\/\/****.myshopify.com\/(?<appId>.+?)\/checkouts\/(?<checkoutToken>.+?)\/thank_you$/;
const result = url.match(pattern);
if (result != null) {
window.location.replace('****');
}
</script>
In summary, this process, executes after an order is completed, upon transitioning to the thank you page, and redirects to any page.
However, when upgrading the thank you page and order status page to Checkout Extensibility, additional scripts will no longer work, and it will be necessary to register pixels using Pixels and customer events. However, it seems that operations using the window object are not available with custom pixels.
Is it possible to redirect to another page from the thank you page after the order is completed? Or if there are any other ideas, I would like to hear them.