Skip to content

Instantly share code, notes, and snippets.

{
"name": "t:sections.header.name",
"type": "header",
"sections": {
"announcement-bar": {
"type": "announcement-bar",
"blocks": {
"announcement-bar-0": {
"type": "announcement",
"settings": {
└─ theme
├─ assets
├─ config
├─ layout
│ └─ theme.liquid
├─ locales
└─ sections
├─ footer-group.json
├─ header.liquid
├─ header-group.json
<ul class="block-grid mobile four-up product-collection">
{% for link in linklist.links %} //Here we are saying use the links in the linklist we created and assign them to the below code
<li>
<div class="product">
{% comment %}
You can connect collections, products, pages, & even blogs. By default it will use the first product that appears on a collection or you can pick a featured image.
{% endcomment %}
{% assign link_item = link.object %} //Creates a new variable for link_item using link.object which in-turn can access any of the attributes that are available (product, collection, page or blog)
{% assign link_image = '' %}//creates a new variable for link_image which assigns
@shopifypartners
shopifypartners / external-video.liquid
Last active February 16, 2023 11:24
Example of a Shopify theme section displaying an externally hosted video
<div class="video-section">
<h2>{{ section.settings.heading }}</h2>
{%- if section.settings.video_url.type == 'youtube' -%}
<iframe src="https://www.youtube.com/embed/{{ section.settings.video_url.id }}" class="youtube" allow="autoplay; encrypted-media" title="{{ section.settings.description | escape }}"></iframe>
{%- else -%}
<iframe src="https://player.vimeo.com/video/{{ section.settings.video_url.id }}" class="vimeo" allow="autoplay; encrypted-media" title="{{ section.settings.description | escape }}"></iframe>
{%- endif -%}
</div>
{% schema %}
@shopifypartners
shopifypartners / a-beginners-guide-to-sass-part-3-interpolation.liquid.scss
Last active February 13, 2023 08:04 — forked from stewartknapman/style.liquid.scss
A Beginner's Guide to Sass with Shopify — Part 3: Sass interpolation, Workflow and Object Oriented CSS - https://www.shopify.com/partners/blog/a-beginners-guide-to-sass-with-shopify-part-3
// Escaping Liquid in SCSS.
//
// Expected output:
// a{
// color: {{ settings.link-color }};
// }
a{
color: #{'{{ settings.link-color }}'};
}
@shopifypartners
shopifypartners / order-status-product.liquid
Last active January 19, 2023 15:20
Script to load specific content for a particular product, on the order status page - https://www.shopify.com/partners/blog/order-status-page
<script>
{% for line in checkout.line_items %}
<!-- DEBUG looking at {{ line.title }} -->
{% if line.title == 'Red Sports Tee' %}
Shopify.Checkout.OrderStatus.addContentBox(
'<h2>Thanks for your order</h2>',
'<p>Have a 10% discount on us! Use AWESOME18 with your next purchase</p>'
)
{% endif %}
{% endfor %}
article
blog
checkbox
collection
color
font_picker
hidden
html
image
image_picker
{% unless template == 'index' or template == 'cart' or template == 'list-collections' or template == '404' %}
{% assign t = template | split: '.' | first %}
<nav class="breadcrumbs" role="navigation" aria-label="breadcrumbs">
<ol>
<li>
<a href="/" title="Home">Home</a>
</li>
@shopifypartners
shopifypartners / jquery-image-zoom-code-triggered-by-image-zoom-class.html
Last active November 29, 2022 21:39
Code triggered by the added `image-zoom` class on the main product image – https://www.shopify.com/partners/blog/jquery-image-zoom
<script>
$(document).ready(function(){
$('.image-zoom')
.wrap('<span style="display:inline-block"></span>')
.css('display', 'block')
.parent()
.zoom({
url: $(this).find('img').attr('data-zoom')
});
});
<table class=”responsive-table”>
<thead>
<th>Product</th>
<th>Price</th>
<th>Quantity</th>
<th>Total</th>
</thead>
</tbody>
{% for item in cart.items %}
<tr class=”responsive-table__row”>