<!-- no need for thumnails unless there is more then one image -->
<% if product.images.size > 1 %>
  <ul id="product-thumbnails" class="thumbnails inline" data-hook>
    <% product.images.each do |i| %>
      <li class="tmb-all" id="tmb-<%= i.id.to_s %>"><%= link_to image_tag(i.attachment.url(:mini)), i.attachment.url(:product) %></li>
    <% end %>
    <% if @product.has_variants?
      @variants.each do |v|
        if v.available?
          v.images.each do |i| %>
            <li class="vtmb-<%= v.id.to_s %> vtmb" id="tmb-<%= i.id.to_s %>"><%= link_to image_tag(i.attachment.url(:mini)), i.attachment.url(:product) %></li>
          <%
          end
        end
      end
    end
    %>
  </ul>
<% end %>

<!-- no need for thumnails unless there is more then one image -->
<% if product.images.size > 1 || product.variant_images.size > 0 %>
  <ul id="product-thumbnails" class="thumbnails inline" data-hook>
    <% product.images.each do |i| %>
      <li class="tmb-all" id="tmb-<%= i.id.to_s %>"><%= link_to image_tag(i.attachment.url(:mini)), i.attachment.url(:product) %></li>
    <% end %>
    <% if @product.has_variants?
      @variants.each do |v|
        if v.available?
          v.images.each do |i| %>
            <li class="vtmb-<%= v.id.to_s %> vtmb" id="tmb-<%= i.id.to_s %>"><%= link_to image_tag(i.attachment.url(:mini)), i.attachment.url(:product) %></li>
          <%
          end
        end
      end
    end
    %>
  </ul>
<% end %>

Check for existence of variant_images in _thumbnails partial
Check for existence of variant_images in _thumbnails partial
