All things Shopify and commerce
I need help trying to create separate redirect URLs when different products are purchased. Currently, I use this code to redirect after this specific product is purchased, and it works. I tried duplicating the code and changing the URL and product ID, but it redirects to the URL in the original code.
<script> window.location ="https://app.squarespacescheduling.com/schedule.php?owner=27901056&appointmentType=40249668 "; </script> try { let redirect_url = 'https://app.squarespacescheduling.com/schedule.php?owner=27901056&appointmentType=40249668'; let redirect_prod_ids = [8132767121716]; 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 }
I'm not very familiar with coding so any help would be great!
User | RANK |
---|---|
40 | |
25 | |
22 | |
16 | |
14 |
Explore the 30-30-30 rule, a dynamic social media strategy for new businesses. Learn how t...
By Trevor Sep 20, 2023Discover how to leverage the often overlooked footer of your ecommerce site to gain custom...
By Skye Sep 15, 2023In this blog, we’ll be shining a light on Shopify Partners, Experts, and Affiliates. Who a...
By Imogen Sep 13, 2023