Skip to content

Instantly share code, notes, and snippets.

@odessy
odessy / gist:927c6bc229d9e13c865fc6fe9d868ff8
Created October 23, 2025 20:44
Sticky add to cart with wrapper
{%- if product.available -%}
<div x-data="{visible: false, sectionId: '{{ section.id }}', productId: '{{ product.handle }}', ...handleClick, ...showButton}">
<template x-teleport="body">
<div
@theme:scroll.document="showButton"
x-show.opacity="visible"
class="buy-it-now-wrapper block left-0 bottom-0 fixed z-20 w-full p-r5">
<button
@click="handleClick"
class= "btn btn--primary btn--full uppercase btn--add-to-cart buy-it-now block">{{'products.product.add_to_cart' | t}}</button>
@odessy
odessy / product-metaobject-swatches.liquid
Created October 23, 2025 18:21
Shopify metaobject swatches on product page
let ColorMatch = class ColorMatch {
init() {
...
const newColors = document.querySelector('[data-swatches-json]');
if (newColors && newColors.innerHTML !== '') {
const colors = JSON.parse(newColors.innerHTML);
return Promise.resolve(this.matchColors(colors, this.settings.color));
}
@odessy
odessy / gist:565925e2e4b613cbf3e074028d063638
Created October 6, 2025 15:25
Apple touch icon liquid code
<link rel="apple-touch-icon" sizes="180x180" href="{{ settings.favicon | img_url: '180x180' }}" />
@odessy
odessy / gist:86de239e881e3499a50f8ecedfaab040
Created September 18, 2025 15:17
Cart taxes included
{%- if cart.taxes_included -%}
<p class="taxes-included-message" style="padding-bottom: 10px;">
{{ 'cart.general.shipping_at_checkout' | t }}
</p>
{%- endif -%}
@odessy
odessy / gist:a44b9b9de4984c61f2b3cec9a94eed9a
Last active September 11, 2025 15:39
Shopify metaobject swatches on product page
<fieldset class="radio__fieldset" style="margin-bottom: 12px;">
<legend class="radio__legend" aria-label="{{ 'home_page.onboarding.color' | t }}">
<span class="radio__legend__label">{{ 'home_page.onboarding.color' | t }}</span>
</legend>
{% for color_item in product.metafields.shopify.color-pattern.value %}
{% if color_item %}
<radio-swatch class="swatch__button{% if settings.swatches_squares %} swatch__button--square{% endif %}">
<label {% if color_item.color != null %} data-swatch style="--swatch: {{ color_item.color }}"{% endif %}>
{% if color_item.image %}
{% render 'image', img_object: color_item.image.value, width: 34, wh_ratio: 1 %}
@odessy
odessy / gitbook_csv_export.py
Created August 8, 2025 18:23
Export document from gitbook web pages
import requests
from bs4 import BeautifulSoup, Tag
import csv
import re
from urllib.parse import urljoin
from typing import List, Dict, Optional
# Configuration
BASE_URL = "https://pipeline.groupthought.com/"
HEADERS = {
/* CSS - change Add to Cart button color */
.product__form--buybutton .product__submit__add {
background-color: var(--primary);
border: 1px solid var(--primary);
color: var(--primary-opposite);
}
.product__form--buybutton .product__submit__add:hover,
.product__form--buybutton .product__submit__add:focus {
background-color: var(--primary-hover);
border: 1px solid var(--primary-hover);
@odessy
odessy / gist:1478dd7bc95532d2ec5072dc44214d1e
Created July 22, 2025 16:58
Hide section if image settings is blank
data-section-id="{{ section.id }}"
@odessy
odessy / gist:c2ad3d0069a2bccfed048869f43f9eb4
Last active July 15, 2025 16:01
Product siblings block height option and custom sibling label
<!-- /snippets/product-siblings.liquid -->
{%- liquid
assign sibs_collection = collections[block.settings.siblings_collection].products
assign cutline_default = block.settings.cutline | default: product.metafields.theme.cutline.value
assign old_siblings_label = 'general.siblings.label' | t | default: 'Color'
assign siblings_label = block.settings.cutline_label | default: old_siblings_label
-%}
{%- if sibs_collection.size > 1 -%}
var links = document.links;
for (let i = 0, linksLength = links.length ; i < linksLength ; i++) {
if (links[i].hostname !== window.location.hostname) {
links[i].target = '_blank';
links[i].rel = 'noreferrer noopener';
}
}