Skip to content

Instantly share code, notes, and snippets.

View jonathanmoore's full-sized avatar
🚀
Building for Shopify

Jonathan Moore jonathanmoore

🚀
Building for Shopify
View GitHub Profile
@jonathanmoore
jonathanmoore / district-cart-attributes.liquid
Created March 4, 2022 22:51
Cart Liquid Block Custom Attributes
<div class="cart-block__attributes flex items-center space-x-2 justify-center md:justify-end">
<input form="cart" type="hidden" name="attributes[Gift]" value="No">
<input id="Cart-Attribute-Gift" form="cart" type="checkbox" name="attributes[Gift]" value="Yes"{% if cart.attributes["Gift"] == "Yes" %} checked{% endif %}>
<label for="Cart-Attribute-Gift" class="text-primary-text p-0 text-sm font-body font-weight-body normal-case tracking-normal">Is this a gift?</label>
</div>
{% assign current_variant = product.selected_or_first_available_variant %}
<span class="variant-sku">{{ current_variant.sku }}</span>
@jonathanmoore
jonathanmoore / gist:03b0ce72748423ac30f9d4582f318af9
Created March 30, 2022 14:21
District OS 2.0 Custom Cart Attribute - Birthday
<div class="cart-block__attributes flex items-center space-x-2 justify-center md:justify-end">
<input id="Cart-Attribute-Birthday" form="cart" type="date" name="attributes[Birthday]" value="">
<label for="Cart-Attribute-Birthday" class="text-primary-text p-0 text-sm font-body font-weight-body normal-case tracking-normal">Birthday</label>
</div>
{% liquid
assign low_stock_threshold = 5
assign selling_fast_threshold = 12
assign low_stock_status = "Low stock"
assign selling_fast_status = "Selling fast"
assign in_stock_status = "In stock"
assign low_stock_color = "#FFD700"
assign selling_fast_color = "#008000"