Skip to content

Instantly share code, notes, and snippets.

Shopify Partners shopifypartners

Block or report user

Report or block shopifypartners

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View spacing-system-4.scss
@for $space from 0 through $spacing-limit {
$value: $space + rem;
}
View spacing-system-2.scss
$spacing-key: (
"top": "top",
"right": "right",
"left": "left",
"btm": "bottom",
"all": null,
"vert": null,
"horiz": null
);
View relative-pagination.rb
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
View pagination-with-since_id.json
{
"products": [
{
"id": 11111,
"title": "Paprika"
},
{
"id": 12345,
"title": "Chili Powder"
},
View product-recommendations-section.liquid
{%- 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>
View product-recommendations-heading.liquid
{
"type": "text",
"id": "heading",
"label": "Heading",
"default": "You might also like"
}
View product-recommendations-checkbox.liquid
{
"type": "checkbox",
"id": "show_product_recommendations",
"label": "Turn on product recommendations",
"default": false
}
View product-reccomendations-script.js
{% 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
You can’t perform that action at this time.