Skip to content

Instantly share code, notes, and snippets.

# Insomnia Configuration
## Run the test query
{
shop {
id
name
}
}
# Query Structure Examples
@shopifypartners
shopifypartners / videos.liquid
Created January 4, 2023 14:30
Example of a Shopify theme section that displays both externally hosted videos and videos uploaded via the store admin
<div class='video-section'>
<h2>{{ section.settings.heading }}</h2>
{% for block in section.blocks %}
{% case block.type %}
{% when 'video-stored' %}
<div class="stored-video" {{ block.shopify_attributes }}>
{{ block.settings.video | media_tag }}
</div>
{% when 'external-video' %}
<div class ="external-video"{{ block.shopify_attributes }}>
{% schema %}
{
"name": "Section name",
"settings": []
}
{% endschema %}
{% stylesheet %}
{% endstylesheet %}
@shopifypartners
shopifypartners / video-by-upload.liquid
Created January 4, 2023 14:28
Example of a Shopify theme section displaying a video uploaded via the store admin
<div class="video-section">
<h2>{{ section.settings.heading }}</h2>
{{ section.settings.video | video_tag }}
</div>
{% schema %}
{
"name": "Video",
"settings": [
{
<html>
<head>
<script src="https://cdn.shopify.com/s/assets/external/pos_app.js"></script>
</head>
<body>
<script type="text/javascript">
ShopifyPOS.init({
apiKey: "0dc181105f1912f21b5de1a0ae64db37",
shopOrigin: "https://CURRENT_LOGGED_IN_SHOP.myshopify.com"
});
@shopifypartners
shopifypartners / related-products-by-tag-group.liquid
Last active July 4, 2023 10:04
Code for section which generates related products based on grouping tags - https://www.shopify.com/partners/blog/related-products
@shopifypartners
shopifypartners / product-variants-drop-down-options.html
Last active April 13, 2023 09:31
Container for product options, which pulls a deep-linked variant as default - https://www.shopify.com/partners/blog/product-variants
<select name="id" id="ProductSelect-{{ section.id }}" class="product-form__variants no-js">
{% for variant in product.variants %}
{% if variant.available %}
<option {% if variant == product.selected_or_first_available_variant %} selected="selected" {% endif %} value="{{ variant.id }}">
{{ variant.title }}
</option>
{% else %}
<option disabled="disabled">{{ variant.title }} - {{ 'products.product.sold_out' | t }}</option>
{% endif %}
{% endfor %}