Custom Storefront API - Checkout return url

Custom Storefront API - Checkout return url

Gustaf
Visitor
3 0 0

Is there any way to define a return url when creating a checkout through the custom storefront API? When we redirect our customers to the Shopify checkout we want the users to have an easy way to return to the site, but when creating a checkout through this API the checkout is stripped of the "Return to cart"-link and the logo up top in the checkout is only a "#"-href.

I mean, it's pretty much standard in these kind of situations, when you direct a user away from your site (like oauth-authentication), to be able to define a return URL. Is there no way to do this here? If no: Shopify devs, will this be a feature in a near future? It should be a simple, and key-, feature to add..

Replies 4 (4)

Zoran_Ilievski
Shopify Partner
8 0 2

I don't belive there is a way of adding that sort of attribute.

If you are working on a Shopify plus store, I would recommend using JS to change the # attribute to a link back to your site, which is what I have done on our stores.

Gustaf
Visitor
3 0 0

Thanks, yeah I believe it to be impossible to I'm afraid.. I already do inject some javascript in the order confirmation page to do just that, but does plus-members also have the ability to inject javascript into the checkoutflow?

Zoran_Ilievski
Shopify Partner
8 0 2

Correct, being on shopify plus alows you to have access to a checkout.liquid file

Should you be successfull, this is the snippet that I use:

   try {
      var changeLogoURL = function() {
        // Add proper link to cart logo
        var logoNodes = document.querySelectorAll('.logo');
        logoNodes.forEach(function(node){
          node.href = 'https://www.example.com/';
        });
      }
      document.addEventListener('DOMContentLoaded', changeLogoURL);
    } catch (e) {
      console.error(e);
    }

Gustaf
Visitor
3 0 0

Perfect, thanks a bunch! I will recommend my client to upgrade to plus immediately!

 

However I still do hope Shopify adds this quite basic functionality 🙂