Using Checkout Extensibility, how do I send users back to my website after successful payment?

Using Checkout Extensibility, how do I send users back to my website after successful payment?

ndsta
Shopify Partner
5 0 2

All of the documentation I can find for sending users to a custom URL after checkout (either via redirect or a button) refers to the "additional scripts" functionality from Checkout.liquid, but given that this is already deprecated I'd prefer to do it in a more robust way. Can anyone point me in the right direction to get this working? Thanks.

Replies 2 (2)

heddykhalifa
Shopify Partner
231 15 46

Hey Ndsta, 

Heddy from Gameball here. 

With Shopify’s Checkout Extensibility API, there’s actually a built-in way to handle post-payment redirections. You’d want to use the Order Status Page extension, which allows you to customize what happens after a successful checkout, like adding a button or an automatic redirect to your website.

Here’s a general approach:

  1. Create an Order Status Page extension within your app.
  2. In this extension, you can either:
    -Add a button that links back to your website (something like "Continue Shopping" or "Go Back to Store").
    -Or, if you want a more automated approach, you could write JavaScript to trigger a redirect as soon as the order is complete.

You’ll be working mostly with Shopify’s Checkout Extensibility API, and if you haven’t set up the Order Status Page extension yet, that’s the place to start.

If you want something as straightforward as a redirect, you can include a JavaScript snippet that redirects users based on certain criteria—like successful payment or order completion.

That should give you more flexibility and future-proof the process a bit better than using deprecated methods.

ndsta
Shopify Partner
5 0 2

Thanks very much Heddy, I was able to get an app built and installed with the necessary extension, and I'm able to console.log the URL I need to redirect to on the Thank You screen (including some parameters from the api object). However, as far as I can tell, it's neither possible to change the text/URL of the "Continue Shopping" button:

 

https://community.shopify.com/c/shopify-discussions/how-can-i-alter-the-continue-shopping-button-on-...

 

…nor to redirect automatically:

 

https://community.shopify.com/c/extensions/how-to-redirect-from-thank-you-page-extensions-to-another...

 

(I've tried a simple window.location.href, but that fails with “ExtensionUsageError: ReferenceError: window is not defined”.)

 

Please let me know if you think I've missed or overlooked something, but based on what I've been able to determine it looks like it might not be possible to redirect users from the thank you screen (either manually or automatically) with Checkout Extensibility.