Skip to content

Instantly share code, notes, and snippets.

@shelldandy
Last active December 10, 2017 04:05
Show Gist options
  • Save shelldandy/aca6d3c37ddf23ad4811a2b37603a366 to your computer and use it in GitHub Desktop.
Save shelldandy/aca6d3c37ddf23ad4811a2b37603a366 to your computer and use it in GitHub Desktop.
// Paste in console on the product list in the admin
// EXAMPLE
// https://************.myshopify.com/admin/products
// Select all the links to product pages
function downloadSP (name) {
$(`tbody td a[href^="/admin/${name}"]`).each(function (index) {
const me = $(this)
// Grab the original href
const url = me.attr('href')
const name = me.text().split(' ').join('_').split('.').join('_')
// apprend .json
me.attr('href', `${url}.json`)
// add download attribute with the name of the product
me.attr('download', index + '-' + name)
})
}
// Now just click each one
// Profit!
// Paste in console on the product list in the admin
// EXAMPLE
// https://************.myshopify.com/admin/products
// Select all the links to product pages
$('tbody td a[href^="/admin/products"]').each(function (index) {
const me = $(this)
// Grab the original href
const url = me.attr('href')
const name = me.text().split(' ').join('_').split('.').join('_')
// apprend .json
me.attr('href', `${url}.json`)
// add download attribute with the name of the product
me.attr('download', index + '-' + name)
})
// Now just click each one
// Profit!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment