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


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]);
0 out of 0 found this helpful



Please sign in to leave a comment.