Skip to content

Instantly share code, notes, and snippets.

View dylanjhunt's full-sized avatar

Dylan Hunt dylanjhunt

View GitHub Profile
@dylanjhunt
dylanjhunt / product-card-variant.liquid
Created April 20, 2020 13:16
Show all products as separate variants on the collection page of the Venture Theme
<!-- /snippets/product-card.liquid -->
{% comment %}
The product card snippet is passed a liquid object, used in this file
as "product". The object is either "product" or "item", the latter if
it is from search results.
{% endcomment %}
<a href="{{ variant.url | within: collection }}" class="product-card">
{% comment %} <img src="{{ variant.image.src | img_url: '480x480' }}" alt="{{ variant.image.alt | escape }}" class="product-card__image"> {% endcomment %}
@dylanjhunt
dylanjhunt / collection.liquid
Created April 20, 2020 13:14
Show all products as separate variants on the collection page of the Venture Theme
{% paginate collection.products by 35 %}
<div class="page-width">
<header class="grid medium-up--grid--table section-header small--text-center">
<div class="grid__item medium-up--one-half section-header__item">
<h1 class="section-header__title">
{{ collection.title }}
{% if current_tags %}
&ndash; {% assign title_tags = current_tags | join: ', ' %}
{% case section.settings.grid %}
{% when 2 %}
{%- assign max_height = 530 -%}
{% when 3 %}
{%- assign max_height = 345 -%}
{% when 4 %}
{%- assign max_height = 250 -%}
{% when 5 %}
{%- assign max_height = 195 -%}
{% endcase %}
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'ecomm__orderValue': '{{ checkout.total_price | money_without_currency }}',
'ecomm__orderNumber': '{{ checkout.order_number }}',
'ecomm__itemCount': '{{ line_items.size }}',
'ecomm__customerEmail': '{{ checkout.customer.email }}'
});
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
{% assign found_title = false %}
{% for item in checkout.line_items %}
{% if item.variant.id == 7387208286253 %}
{% assign found_title = true %}
{% endif %}
{% endfor %}
{% if checkout.subtotal_price > 10000 and found_title == false %}
<script>
@dylanjhunt
dylanjhunt / impulse theme show variants separately
Last active March 17, 2022 10:45
Showing variants as separate products on the Impulse Shopify theme - https://dylanjh.com
{% assign color_active = false %}
{% for option in product.options %}
{% if option == 'Color' %}
{% assign color_active = true %}
{% endif %}
{% endfor %}
{% if product.variants.size > 1 and color_active == true %}
{% for option in product.options %}
{% if option == 'Color' or option == 'Colour' %}
{% assign index = forloop.index0 %}
<script src="//foursixty.com/media/scripts/fs.embed.v2.5.js" data-feed-id="william-painter" data-theme="showcase_v2_5" data-page-size="10" data-connector-filter="28394"></script><style>.fs-has-links::after { padding: 5px 7.5px; background-color: rgb(212, 159, 15); color: rgba(255, 255, 255, 0.7); content: "SHOP IT"; }.fs-desktop .fs-entry-container { width: 20% !important; padding-top: 20% !important; }.fs-mobile .fs-entry-container { width: 50% !important; padding-top: 50% !important; }.fs-wrapper div.fs-text-container .fs-entry-title, div.fs-detail-title{font-family:Montserrat, sans-serif;font-style:italic;font-weight:normal;}div.fs-text-container .fs-entry-date, div.fs-detail-container .fs-post-info, div.fs-wrapper div.fs-has-links::after, .fs-text-product, .fs-overlink-text{font-family:Montserrat, sans-serif;font-style:normal;font-weight:bold;}.fs-wrapper div.fs-text-container * {color:rgb(212, 159, 15)}.fs-wrapper div.fs-text-container {background-color:rgba(255, 255, 255, 0.7); margin: 0px}div.fs-entr
@dylanjhunt
dylanjhunt / product-grid-item.liquid
Created June 6, 2019 14:32
Showing variants as separate products on the supply theme - https://dylanjh.com
{% if product.variants.size > 1 %}
{% for option in product.options %}
{% if option == 'Color' %}
{% assign index = forloop.index0 %}
{% assign colorlist = '' %}
{% assign color = '' %}
{% for variant in product.variants %}
{% capture color %}
{{ variant.options[index] }}
{% endcapture %}
@dylanjhunt
dylanjhunt / product-card-grid-variant.liquid
Last active April 28, 2020 16:53
Show all products as separate variants on the collection page of the Debut Theme
{% comment %}
Renders a product card using "Grid" style
Accepts:
- max_height: {Number} Maximum height of the product's image (required)
- product: {Object} Product Liquid object (required)
- show_vendor: {Boolean} Show the product's vendor depending on the section setting (optional)
Usage:
{% include 'product-card-grid', max_height: max_height, product: product, show_vendor: section.settings.show_vendor %}
{% endcomment %}
@dylanjhunt
dylanjhunt / Show all variants as separate products on the collection page on the Minimal Theme
Created March 12, 2019 15:03
Show all variants as separate products on the collection page on the Minimal Theme - https://dylanjh.com
{% if product.variants.size > 1 %}
{% for option in product.options %}
{% if option == 'Color' %}
{% assign index = forloop.index0 %}
{% assign colorlist = '' %}
{% assign color = '' %}
{% for variant in product.variants %}
{% capture color %}
{{ variant.options[index] }}
{% endcapture %}