Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I want to redirect users to an external website once they checkout successfully. Adding additional scripts on the Post-purchase page didn't work
here is my script but it didn't work. Even a console log doesn't work.
<script>
document.addEventListener('DOMContentLoaded', function() {
if (window.location.href.indexOf('/thank_you') > -1) {
var orderId = Shopify.checkout.order_id;
var redirectUrl = 'http://example.com/?order_id=' + orderId;
window.location.href = redirectUrl;
}});
</script>
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025