Removing Camera Icon in Multiple Shipping Address Default Checkout

Follow

If Giftship's default checkout is used when shipping to multiple addresses, the product images will be replaced by a default camera icon. This is a side effect of how we must build the checkout. If you would like to remove the product images when shipping to multiple addresses, you can add the following snippet of JavaScript to the 'Additional Google Analytics JavaScript' section of your Online Store's preferences panel. To find this, from your store's dashboard go to Online Store --> Preferences --> Google Analytics --> Additional Google Analytics JavaScript (or 'Add Google Analytics JavaScript' if you haven't previously added anything).

  window.onload = function(){

    var image_columns = document.getElementsByClassName('product__image'),
    columns_len = image_columns !== null ? image_columns.length : 0,
    product_images = document.querySelectorAll('.product__image .product-thumbnail__image'),
    all_default = true,
    len = product_images !== null ? product_images.length : 0,
    i = 0;


    for(i; i < len; i++) {
      if ((product_images[i].getAttribute("src")).indexOf("product-blank-") !== -1) {
      } else {
      all_default = false;
      }
    }

    if (all_default === true) {
      i = 0;
      for(i; i < columns_len; i++) {
        image_columns[i].style.display = 'none';
      }

      var css = '.product__image { display: none !important; }',
          head = document.head || document.getElementsByTagName('head')[0],
          style = document.createElement('style');

          style.type = 'text/css';
          if (style.styleSheet){
            // This is required for IE8 and below.
            style.styleSheet.cssText = css;
          } else {
            style.appendChild(document.createTextNode(css));
          }

          head.appendChild(style);
    }
  };

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.