Skip to content

Instantly share code, notes, and snippets.

@svaustin66
svaustin66 / product__accordion.liquid
Created February 28, 2022 02:36
Product Accordion Section
{% style %}
#shopify-section-{{ section.id }} {
padding-top: {{ section.settings.padding_top }}px;
padding-bottom: {{ section.settings.padding_bottom }}px;
padding-left: {{ section.settings.padding_left }}px;
padding-right: {{ section.settings.padding_right }}px;
{% if section.settings.width == 'wide' -%}
width: 100%;
{%- elsif section.settings.width == 'half' -%}
width: 50%;
@svaustin66
svaustin66 / template-subscription.liquid
Created December 6, 2021 00:13
Liquid code for the subscription template to check customer has correct tag
{% if customer.tags contains 'Active Subscriber' %}
<main id="template-{{ template | replace: '.', '-' | handle }}" class="shopify-section article-page" data-check-for-order="true">
{% section 'article__banner' %}
<section class="section__wrapper
section
">
<div class="container">
{% section 'article__sidebar' %}
{% section 'article__main' %}
@svaustin66
svaustin66 / theme.liquid
Created December 5, 2021 23:58
Restrict access by page to certain parts of a Shopify store
<html lang="{{ shop.locale }}">
{% if template contains "subscription" %}
<!-- Subscription Content -->
{% unless customer %}
{% assign send_to_login = true %}
{% endunless %}
{% endif %}
{% if send_to_login and request.path != "/challenge" %}
@svaustin66
svaustin66 / file.liquid
Created December 5, 2021 23:34
Granting Access to Content to Certain Logged in Users
{% if customer and customer.tags contains 'Your Tag' %}
Your Content
{% endif %}
@svaustin66
svaustin66 / theme.liquid
Created December 5, 2021 23:03
Requiring login across the entire Shopify store
<html lang="{{ shop.locale }}">
<head>
{% unless customer %}
{% if template contains 'customers' %}
{% assign send_to_login = false %}
{% else %}
{% assign send_to_login = true %}
{% endif %}
{% endunless %}
@svaustin66
svaustin66 / cart-simple-cross-sell.liquid
Created November 27, 2021 01:04
Simple cross-sell section for Turbo theme
{% if section.settings.cart_cross_sell_enable %}
<!-- Start Cross Sell Section -->
<script
type="application/json"
data-section-type="cart-simple-cross-sell"
data-section-id="{{ section.id }}"
>
</script>
@svaustin66
svaustin66 / cart-gift-with-purchase.liquid
Created November 26, 2021 21:08
Free Gift with Purchase Shopify Theme Snippet
{% assign cart-size = cart.total_price | divided_by: 100 %}
{% assign threshold-1 = section.settings.top_order_threshold | minus: 0.01 %}
{% assign threshold-2 = section.settings.second_order_threshold | minus: 0.01 %}
{% assign threshold-3 = section.settings.third_order_threshold | minus: 0.01 %}
{% assign threshold-4 = section.settings.fourth_order_threshold | minus: 0.01 %}
{% if cart-size > threshold-1 %}
{% unless section.settings.cart_gwp_product_1 == blank %}
{% assign gwp1 = 0 %}
@svaustin66
svaustin66 / cart__gift_with_purchase.liquid
Last active March 1, 2022 16:56
Free Gift With Purchase Shopify Theme Section
{% if section.settings.show_section %}
{% include 'cart-gift-with-purchase' %}
{% endif %}
{% schema %}
{
"name": "Gift with Purchase",
"class": "gwp-section",
"settings": [
{
<button type="submit" name="add" class="action_button add_to_cart" >
{% if product.tags contains 'Gift Box' %}
<input type="hidden" name="return_to" value="/pages/add-a-box" />
{% endif %}
<span class="text">{{ add_to_cart_label }}</span>
</button>
@svaustin66
svaustin66 / collection-template-photos.liquid
Created December 6, 2020 23:48
This Shopify section will show the product photos in a collection that are smaller than the threshold set.
<section class="section__wrapper section">
<div class="container content">
<h1>{{collection.title | escape }}</h1>
{% if collection.description != blank %}
<div>{{ collection.description }}</div>
{% endif %}