Skip to content

Instantly share code, notes, and snippets.

@thisislawatts
Last active October 10, 2015 11:02
Show Gist options
  • Save thisislawatts/4de5942cf5cee9a42e79 to your computer and use it in GitHub Desktop.
Save thisislawatts/4de5942cf5cee9a42e79 to your computer and use it in GitHub Desktop.
Shopify Pages Export & Import via CLI
# Connect to the store you're exporting from
include ShopifyAPI
File.write('pages.data', Page.all.to_json )
# Store you're looking to add pages into
include ShopifyAPI
d = JSON.parse(File.read('pages.data'))
d.each do |p|
attr = p;
# Remove some attributes which will through an error
attr.delete('id')
attr.delete('shopify_id')
# Create Page via API
i = Page.new(attr)
i.save()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment