Last active
April 20, 2018 12:50
-
-
Save j7u7l7s/20917068cc8ae086d7baca0da40b1ce6 to your computer and use it in GitHub Desktop.
Get all products in collection via ajax.js
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
$.ajax({ | |
url:'https://michele-mclaughlin-music.myshopify.com/collections/sheet-music?view=ajax', | |
type:'GET', | |
success: function(data){ | |
var dataDump =JSON.parse(data); | |
console.log(dataDump);} | |
}); |
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
{% layout none %} | |
{%- paginate collection.products by 1000 -%} | |
[ | |
{%- for a in collection.products -%} | |
{ | |
"productData{{- forloop.index -}}": { | |
"featuredImage":{{ a.featured_image | img_url: '600x' | json }}, | |
"songTitle":{{ a.metafields.song_title.key | json}}, | |
"albumKey":{{ a.metafields.album.key | json }}, | |
"keySig":{{ a.metafields.key-sig.key | json}}, | |
"difficulty":{{ a.metafields.difficulty.key | json }}, | |
"variantPrice":{{ a.selected_or_first_available_variant.price | money | json }}, | |
"variantId":{{ a.selected_or_first_available_variant.id | json}} | |
} | |
} | |
{%- unless forloop.last -%},{%- endunless -%} | |
{%- endfor -%} | |
] | |
{%- endpaginate -%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment