Last active
October 10, 2015 11:02
-
-
Save thisislawatts/4de5942cf5cee9a42e79 to your computer and use it in GitHub Desktop.
Shopify Pages Export & Import via CLI
This file contains hidden or 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
# Connect to the store you're exporting from | |
include ShopifyAPI | |
File.write('pages.data', Page.all.to_json ) |
This file contains hidden or 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
# 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