How to redirect user on my website from shopify after checkout's thank you page

We have our own website and we are using shopify API and SDK to list and checkout product. Now I want after purchasing product user will redirect on my website from shopify’s checkout thank you page. How can we do this ?

Hi @ShradhaVaishy , go to settings > checkout > order processing. Add this code in Additional Scripts:

setTimeout(function() {
   window.location.href = "https://example.com";
}, 2000);

replace example.com with your url. Redirection will happen two seconds after customer lands on thank you page, so change that with the value you’d like.

Hello

You need to add the tags around it.


How add cartId and orderId as part of url parameters before redirecting?

Use javascript to extract that from the URL, then make a redirect and send the data in the url, example: https://somewebsite.com/thankyou?cartid=12312&orderid=12312

Hi @MarinaPetrovic
Thanks for this information.
I want to add validation so only users with certain manual payments will be redirected to another page. Is it possible?

thank you

Hello @Pandaboomer & @MarinaPetrovic

First, thanks for the code, it´s working fine!

But I would like to redirect my costumer to different URLs, based on the product that he/she purchased.

I mean, for each Product ID, a different redirect URL.

Can you help me with coding it?

Many thanks in advance!

Hello, did you find any way to do that? i want to do the same thing on my store and i feel like a hit a close door.

Hi, thanks for that but it’s not working in our shop. is it possible that with Checkout Extensibility it doesn’t work? Looking at the image, did I do right (Post-purchase page is the only section where I can put an additional script)? thanks again

Hi @hypefast-tech there is a way, I’m gonna need more details in order to give you exact solution, but it would be something like:


Hi @MarinaPetrovic

could be the Checkout Extensibility that doesn’t make it work? Do you have any suggestions?

Many thanks.

This is not deprecated?

Is this deprecated how to get to the link?

Any update on how this works now that the additional scripts are deprecated?