Ensuring the Logo Link is Active and ‘Back to Cart’ Breadcrumb is Always Present During Checkout

*Update: the instructions in this article no longer work, as Shopify updated the “Additional Google Analytics Javascript” feature to no longer allow the checkout to be modified. This article will remain here for historical purposes, and as a code snippet for Shopify Plus users, who can access the checkout.liquid file.

Original Content:

Since Giftship + Multiship create the multiple shipping address checkout via the Shopify API, you may notice that you no longer see the cart breadcrumb and the logo does not link back to the shop.

If you would like to ensure that the logo always has a link back to the shop page, we can insert this snippet into the ‘Additional Google Analytics JavaScript’ section of your preferences page, by going to Online Store –> Preferences.

window.onload = function(){    var logos = document.getElementsByClassName('logo'),
    broken_logo = false,
    cart_crumb = document.createElement('li'),
    breadcrumb = document.getElementsByClassName('breadcrumb')[0],
    len = logos !== null ? logos.length : 0,
    i = 0;
    for(i; i < len; i++) {
      if (logos[i].getAttribute("href").charAt(0) === "#") {
      broken_logo = true;
      logos[i].href = document.referrer;
      }
    }
    if (broken_logo === true) {
      cart_crumb.className += "breadcrumb__item";
      cart_crumb.className += " breadcrumb__item--blank";
      cart_crumb.innerHTML = '<a class="breadcrumb__link" href="https://' + document.location.hostname + '/cart">Cart</a><svg class="icon-svg icon-svg--color-adaptive-light icon-svg--size-10 breadcrumb__chevron-icon" aria-hidden="true" focusable="false"> <use xlink:href="#chevron-right"></use> </svg>';
      breadcrumb.insertBefore(cart_crumb, breadcrumb.childNodes[0]);
    }
  };

Can't find the answer in our documentation?
Contact Support