Redirect purchase confirmation to a thank you page on my own site (Webflow)

After a purchase is Completed, I need to redirect them to a thank you page on the site. I am using Webflow. I saw some documentation on this ( providing some code snips), but it is not working and Im not at all clear what to do and how to set it up.

I put the code into the Head code for the entire site in the webflow settings

Is anyone able to help me with this?

@Gift Can you tell me what version of Snipcart are you using? I you are using v3, what you could do is check for cart confirm event and then set a redirect from there. something like this

<script>
document.addEventListener('snipcart.ready', () => {     window.Snipcart.events.on('cart.confirmed', async (cartConfirmResponse) => {     window.location.replace("http://example.com/custom_page"); 
}) });
</script>