Change the continue shopping button link

Hi,

I’m working on a use case where I’m creating a checkout via API and this works great. I wanted to update the link to redirect to my website instead of my shopify store.

I tried adding

<script>
window.addEventListener('load', function() {
 const checkoutLinkRedirect =Array.from(document.querySelectorAll('a'))
  .find(el => el.textContent === 'Continue shopping');
 
if (checkoutLinkRedirect) {
const newUrl = 'https://yahoo.com';
checkoutLinkRedirect.href = newUrl;
}
});
</script>

Also tried updating main-cart-items.liquid file

But now of them seem to work. Can someone please take a look?

Thanks,

Sunny