Is it Possible that the user will redirect back to my website after successful/failed Payment.
Hi Jitenda,
Kevin here - a Shopify Guru :)
Yes this is possible to do by entering in some code into the Additional Scripts section of the Checkout area of your admin.
Such code would be:
<style type="text/css">body {display:none}</style>
<script type="text/javascript">
window.location.replace("https://yourstoresname.myshopify.com");
</script>
Whatever URL you enter there is where the customer will be redirected to after checkout.
I hope this helps!
Kevin | Shopify Guru
If you want to redirect people to a new page, check out a solution I found out at https://stackoverflow.com/a/59726180/7353382
If you want to provide custom code on the checkout page based on the product ID, try the following (user beware, code is ugly):
NOTE: This code is inserted into the Additional Scripts section of the Checkout area. To go there go to Settings > Checkout > scroll down to Additional Scripts.
<script> //the URLs to be redirected to
//replace the below with your own list {% assign redirect_1 = "https://www.URL-HERE.com/1" %} {% assign redirect_2 = "https://www.URL-HERE.com/2" %} {% assign redirect_3 = "https://www.URL-HERE.com/3" %} {% assign redirect_4 = "https://www.URL-HERE.com/4" %}
//replace the above with your own list //the products to check for
//replace the below with your own list {% assign product_1 = 1234567898765 %} {% assign product_2 = 1234567898764 %} {% assign product_3 = 1234567898763 %} {% assign product_4 = 1234567898762 %}
//replace the above with your own list //look at the items in the cart {% for line in checkout.line_items %} //grab the product id of the item
{% if line.product_id == product_1 %} Shopify.Checkout.OrderStatus.addContentBox(
//change the text in here to your liking '<p>You ordered product 1. <a href="{{ redirect_1 }}">Next, please visit this page.</a></p>' ) {% elsif line.product_id == product_2 %} Shopify.Checkout.OrderStatus.addContentBox(
//change the text in here to your liking '<p>You ordered product 2. <a href="{{ redirect_2 }}">Next, please visit this page.</a></p>' ) {% elsif line.product_id == product_3 %} Shopify.Checkout.OrderStatus.addContentBox(
//change the text in here to your liking '<p>You ordered product 3. <a href="{{ redirect_3 }}">Next, please visit this page.</a></p>' ) {% elsif line.product_id == product_4 %} Shopify.Checkout.OrderStatus.addContentBox(
//change the text in here to your liking '<p>You ordered product 4. <a href="{{ redirect_4 }}">Next, please visit this page.</a></p>' )
//add more blocks below here
//add more blocks above here
{% else %} Shopify.Checkout.OrderStatus.addContentBox( '<p>Thank you for your order</p>' ) {% endif %} {% endfor %} </script>
To make this work for you, do the following:
Hi,
I have been trying to redirect my customer to an alternative URL with the below code which I have inputted under "Additional Scripts"
<style type="text/css">body {display:none}</style>
<script type="text/javascript">
window.location.replace("https://hadarinc.co.za");
</script>
It is not redirecting from the Thrid-Party Payment system I am using, It is just sending me back to checkout.
Is there a way to do this or am I doing something wrong?
I just created a public app for one of my client with this purpose, if you want to give a try: https://apps.shopify.com/redirect-after-checkout
User | Count |
---|---|
23 | |
12 | |
9 | |
8 | |
7 |