Tooling to migrate the La Bicicletta online store from Magento 1.9 to Shopify
What you’re looking at is the result of my efforts to help La Bicicletta (a bike shop in Toronto, Canada) migrate their online store from Magento to Shopify.
Thanks to La Bicicletta for releasing this work as open source software! They are a great bunch of humans, giving back to their community by supporting causes like Toronto Hustle. They also happen to run one of the finest bike shops in Toronto and online! Check them out:
Magento was not meeting the needs of the business anymore, the decision was made to move to Shopify. There was a lot of data in Magento, ideally it could be moved to Shopify with some form of automation. Over the course of about 40h of time I went from never having looked at a Magento database schema, to what you are looking at.
This codebase is heavily tied to the requirements of this specific migration, but I think there is a lot to learn in here and apply to your own migration.
The overall workflow here is:
data
directoryFor us this was the right mix of automation and manual effort, that might be different for you.
data/megento_db
Docker will pick it up when you build. NOTE: the .sql
file can have any namemedia/catalog
(on your web server hosting Magento) into data/magento_media
The directory structure should look something like this:
.env
cd
into this project directorydocker-compose build
to build the containersdocker-compose up
to start the databasedocker-compose run --rm app bin/console
docker-compose up
and press Ctrl+C
to shut it downbin/console
This loads up the project and provides an interactive console, you can interact with all of the classes and objects in the project this way.
See a list of tables in the Magento database:
mag = LaBici::Magento.new
mag.db.tables
Search customers in Shopify:
shop = LaBici::Shopify.new
shop.search_customers('favecustomer@example.com')
You get the idea
bin/run
This is used for doing the data migrations, there are four different tasks:
bin/run migrate-simple-products
will migrate all active “simple” products from Magento to Shopifybin/run migrate-configurable-products
will migrate all active “configurable” products from Magento to Shopify. Have a look at the code, odds are your store will have different fields and stuff you want to export, it should give you a rough idea of how to do thisbin/run migrate-customers
will migrate all active customers from Magento into Shopify. Shopify is pretty strict with emails and stuff like that, if your Magento store is big, expect a number of customers to be rejected (fraud usually)bin/run customer-report
will output customer data, this was just me toying around, it may or may not be useful for youbin/activator
This is used for inviting customers to the Shopify store, you don’t have to use this, it’s not part of the data migration. You can find the inner workings in lib/labici/customer_activator.rb
and the available tasks in bin/activator
.
The workflow for using this is:
data/customers.csv
bin/activator import-customers-csv
, this will load all of the customers you wish to generate activation URLs forbin/activator sync-activation-urls
, this will atomically generate activation URLs for each customer in data/customers.csv
bin/activator export-customers-csv
, this will export a new CSV file the same as bin/customers.csv
but with the addition of an Activation URL, you can then use this to send out a bulk email inviting inactive users to activate in Shopify. This is placed in data/customers-with-activation-urls.csv
Open an issue and I’ll try to respond as quickly as I can