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 expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025