Imagine this scenario:
Sarah opts in to a lead magnet on your blog, you offer her a $7 guide as a “tripwire,” she buys it on Shopify, you then offer her a $67 course. This $67 course offer is a secondary tripwire and it can generate great revenue!
Unfortunately, there’s no simple way to do it in Shopify. The thank-you page is not highly customizable. And while there are third-party apps that allow you to customize the thank-you page, they don’t redirect to another page. At least I haven’t been able to find one that does yet, especially not one that redirects based on the product you’ve purchased which is important for secondary tripwires.
But, with just a little bit of code on your Shopify Checkout page, you CAN do this! Here’s how:
- Navigate to Shopify Admin > Settings > Checkout
- Scroll down the page until you see Order Processing and the Additional Scripts box.
- Copy and paste this code:
<script>try {
let redirect_url = ‘YOURURLHERE’;
let redirect_prod_ids = [YOURPRODUCTNUMBERSHERE];
let order_line_items = Shopify.checkout.line_items;
for( var i=0; i<order_line_items.length; i++ ){
if( redirect_prod_ids.includes( order_line_items[i].product_id ) ){
window.top.location.href = redirect_url;
}
}
}catch(err){
//if errors happen in the above code, do nothing
}
</script>
4. Replace the text that reads YOURURLHERE with the URL you want customers to be redirected to.
5. Replace the text that reads YOURPRODUCTNUMBERSHERE with the purchased product number(s) you want to be redirected to the above URL. You can look up the product numbers by going to Shopify Admin > Products > All products > find a product you want and open it, then copy the number at the end of the URL. Separate multiple product numbers with a comma (no spaces).
6. Click Save.
7. Test that it works in your store. When I tested it, sometimes the redirects were instantaneous and sometimes they took a few seconds (I’m not sure why, but possibly something to do with Shopify processing the page).
Notes: If you want more than one of these redirects, just add a second script below the first one in the same place in your settings.
Leave a Reply