This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$spacing-key: ( | |
"top": "top", | |
"right": "right", | |
"left": "left", | |
"btm": "bottom", | |
"all": null, | |
"vert": null, | |
"horiz": null | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$spacing-limit: 4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
products = ShopifyAPI::Product.find(:all, params: { order: 'inventory_total desc', limit: 250 }) | |
process_products(products) | |
3.times do | |
break unless products.next_page? | |
products = products.fetch_next_page | |
process_products(products) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"products": [ | |
{ | |
"id": 11111, | |
"title": "Paprika" | |
}, | |
{ | |
"id": 12345, | |
"title": "Chili Powder" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- if section.settings.show_product_recommendations -%} | |
<div class="product-recommendations" data-product-id="{{ product.id }}" data-limit="4"> | |
{%- if recommendations.products_count > 0 -%} | |
<h2>{{ section.settings.heading }}</h2> | |
<ul> | |
{%- for product in recommendations.products -%} | |
<li class="product"> | |
<a href="{{ product.url }}"> | |
<img class="product__img" src="{{ product.featured_image | img_url: '300x300' }}" alt="{{ product.featured_image.alt }}" /> | |
<p class="product__title">{{ product.title }}</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "text", | |
"id": "heading", | |
"label": "Heading", | |
"default": "You might also like" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "checkbox", | |
"id": "show_product_recommendations", | |
"label": "Turn on product recommendations", | |
"default": false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% javascript %} | |
var loadProductRecommendationsIntoSection = function() { | |
// Look for an element with class 'product-recommendations' | |
var productRecommendationsSection = document.querySelector(".product-recommendations"); | |
if (productRecommendationsSection === null) { return; } | |
// Read product id from data attribute | |
var productId = productRecommendationsSection.dataset.productId; | |
// Read limit from data attribute | |
var limit = productRecommendationsSection.dataset.limit; | |
// Build request URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="product-recommendations" data-product-id="{{ product.id }}" data-limit="4"> | |
{%- if recommendations.products_count > 0 -%} | |
<h2>You may also like</h2> | |
<ul> | |
{%- for product in recommendations.products -%} | |
<li class="product"> | |
<a href="{{ product.url }}"> | |
<img class="product__img" src="{{ product.featured_image | img_url: '300x300' }}" alt="{{ product.featured_image.alt }}" /> | |
<p class="product__title">{{ product.title }}</p> | |
<p class="product__price">{{ product.price | money}}</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% form 'customer_login' %} | |
<div> | |
<label for="customerEmail">Email Address</label> | |
<input type="email" | |
name="customer[email]" | |
id="customerEmail" | |
autocorrect="off" | |
autocapitalize="off" | |
autocomplete="email"> |