Skip to content

Instantly share code, notes, and snippets.

View e-dolan's full-sized avatar

Emma Dolan e-dolan

View GitHub Profile
1. add snippet to cart.liquid file at the bottom of the file
{% include 'upsell-modal' %}
2. add css to theme.liquid in the header
{{ 'upsell-modal.scss' | asset_url | stylesheet_tag }}
@e-dolan
e-dolan / product-swatches-metafields.liquid
Last active February 1, 2024 08:17
Product swatches using metafields and metaobjects
{% comment %}{% render 'product-swatches-metafields', product: product %}{% endcomment %}
{% assign current_product_handle = product.handle %}
{% for product in product.metafields.custom.product_swatch_related_products.value %}
{% assign related_product_handle = product.handle %}
{% endfor %}
<div class="product-swatches__outer">
{% for swatch in product.metafields.custom.colour_swatches.value %}
@e-dolan
e-dolan / add-to-cart.liquid
Created July 3, 2025 10:51
DL Media - Coding Task
<product-form>
// rest of product form functionality
<button
id="btn-ATC_Button"
type="submit"
class="btn-Button_Primary"
data-inventory="{{ product.variants.first.inventory_quantity }}"
{% if product.variants.first.inventory_quantity == 0 %}disabled{% endif %}>
{% if product.variants.first.inventory_quantity == 0 %}
@e-dolan
e-dolan / related-colour-products.liquid
Created March 17, 2026 10:42
Get related (separate products) products by colour - show as a swatch