Ensuring the logo links is active and back to cart breadcrumb is always present during checkout

Follow

Since Giftship + Multiship creates the multiple shipping address checkout via Shopify's 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 however like to ensure that the logo always has a link back to the 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

Comments

0 comments

Please sign in to leave a comment.