Redirect customer after placing order to referrer site (Not mysite.shopify.com)

Highlighted
Shopify Partner
7 1 0

Hi everyone,

 

I'm having trouble with a conditional logic I'm trying to put on my checkout page.

 

I am able to call checkout API with appropriate cart data. From here, customer can pay for order. After completion of order I want to redirect customer to my own web-site (not my-site.shopify.com) from where I redirect customer to shopify.

I can achieve this with some script on script-tags API. But I want to execute that script-tag only and only if customer placed order from my own web-site. I mean If a customer goes to my-site.shopfy.com from my site, then I want to redirect customer on my own web-site. 

 

I found solutions if customer want to purchase one particular variant of one product.  But I want only if customer comes from my own site (referrer).

 

That will be a conditional script. If i don't put any condition, they regular shopify customer (not coming from my own web-site) will be also redirected to my own web site which I don't want to do. Will need some token in response as well.

 

If anyone has any tips or pointers on this, that would be awesome.

Thanks so much!

0 Likes
Shopify Partner
7 1 0

I want to achieve like:

 

<style type="text/css">body { display: none }</style>

<script type="text/javascript">

//LOGIC IF CUSTOMER COMES THROUGH MYSITE.COM (NOT MYSITE.SHOPIFY.COM)

  window.location.replace("https://mycustomstore.com");

</script>

0 Likes