Skip to content

Instantly share code, notes, and snippets.

@arlopezg
Last active March 24, 2018 00:40
Show Gist options
  • Select an option

  • Save arlopezg/348479ae440e30dd37f255c5fbb95889 to your computer and use it in GitHub Desktop.

Select an option

Save arlopezg/348479ae440e30dd37f255c5fbb95889 to your computer and use it in GitHub Desktop.
saveProducts = (arr) => {
const products = new Array()
console.log("Received products:", arr)
arr.products.map((product) =>
products.push({
'id': product.id,
'options': product.options,
'type': product.product_type,
'handle': product.handle,
'title': product.title,
'variants': product.variants,
'images': product.images
})
)
console.log("Saved data:", products)
// write data to HTML
}
jQuery.getJSON('/admin/products.json/', saveProducts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment