Skip to content

Instantly share code, notes, and snippets.

View e-dolan's full-sized avatar

Emma Dolan e-dolan

  • By Association Only
  • UK
  • 04:31 (UTC +01:00)
View GitHub Profile
@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 %}
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 }}