Skip to content

Instantly share code, notes, and snippets.

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
@shopifypartners
shopifypartners / backup_rate_example.yml
Created October 25, 2022 17:14 — forked from krzysztofbialek/backup_rate_example.yml
Backup rates example for Shipping Applications development good practices
rate_definitions:
-
name: Standard
price: 0
currency: CAD
rate_class_id: 10
conditions:
-
field: total_price
criteria: 100
@shopifypartners
shopifypartners / curl_result_example.txt
Created October 25, 2022 17:14 — forked from krzysztofbialek/curl_result_example.txt
Latency curl result example for Shipping Applications development good practices
time_namelookup: 0.326604s
time_connect: 0.467748s
time_appconnect: 0.000000s
time_pretransfer: 0.467986s
time_redirect: 0.000000s
time_starttransfer: 0.584812s
----------
time_total: 0.584852s
@shopifypartners
shopifypartners / curl_example.txt
Created October 25, 2022 17:13 — forked from krzysztofbialek/curl_example.txt
Latency curl example for Shipping Applications development good practices
time_namelookup: %{time_namelookup}s\n
time_connect: %{time_connect}s\n
time_appconnect: %{time_appconnect}s\n
time_pretransfer: %{time_pretransfer}s\n
time_redirect: %{time_redirect}s\n
time_starttransfer: %{time_starttransfer}s\n
----------\n
time_total: %{time_total}s\n
@shopifypartners
shopifypartners / cache_example.rb
Created October 25, 2022 17:13 — forked from krzysztofbialek/cache_example.rb
Cache example for Shipping Applications development good practices
{
destination_address: {
country_code: "CA",
province_code: "QC",
city: "Montreal",
address1: "address 1",
address2: "address 2",
address3: "address 3",
postal_code: "K2K2K2"
},
@shopifypartners
shopifypartners / scrolling-text.liquid
Last active October 18, 2022 03:47
Subtle animation- full markdown for scrolling text section https://www.shopify.com/partners/blog/text-animation-css
<div class="animated-text">
<div id="animated-container">
{{ section.settings.start-text }}
<div id="scroll">
<div><div>{{ section.settings.text1 }}</div></div>
<div><div>{{ section.settings.text2 }}</div></div>
<div><div>{{ section.settings.text3 }}</div></div>
</div>
{{ section.settings.end-text }}
</div>
{% if available %}
{% if product.price_varies and template == 'collection' %}
From {{ product.price_min | money }} to {{ product.price_max | money }}
{% else %}
{{ money_price }}
{% endif %}
{% else %}
{{ 'products.product.sold_out' | t }}
{% endif %}
# Use an array to keep track of the discount campaigns desired.
CAMPAIGNS = [
# $5 off all items with the "sale" tag
ItemCampaign.new(
AndSelector.new(
TagSelector.new("sale"),
ExcludeGiftCardSelector.new,
),
MoneyDiscount.new(5_00, "5$ off all items on sale",),
),
def Shopify.set_product_metafield_map(id, namespace, key, map)
# convert the map to JSON so it fits in one metafield
data = {
"metafield" => {
"namespace" => namespace,
"key" => key,
"value" => map.to_json,
"value_type" => "string"
}
}
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-11-02T17:49:05.621Z",
"__export_source": "insomnia.desktop.app:v6.0.2",
"resources": [
{
"_id": "wrk_566964f3c7d044748b99b8c814e40d8e",
"created": 1538419476867,
"description": "",