Shopware: Data Migration Tools & Best Practices

Shopware Migration & DataIn every project, this is a crucial phase of the project where we migrate from the old platform, whatever that might be to our new platform, and we quickly want to go through a couple of pointers and topics that  we want to keep in mind when doing this and how to actually do that in Shopware 6.

CSV Import Tool

So, what we’ll be talking about is the different options for adding entities or data – such as products, customers to Shopware. We have a couple of flavors there. And then we’ll talk about some of the recommendations we have from the field – from other agencies that have already done this before, from other merchants that have gone through that migration, that we can share with you, to make sure that the migration is as easy as it can possibly be. The first way of importing data is CSV imports, I think this is the most basic way of importing and something that should be familiar to most of you, it’s CSV file that we can generate from Excel or one of those tools. And I think it’s something that most platforms also offer us as an export option, which enables us to use this format for any source.

So in Shopware, we have some no-code and low-code tools for actually running these imports. By default, we have profiles in the CSV import that adhere to the format that Shopware has chosen. So these can be found on their Settings and then Import/Export. If you want to have an example, there is the documentation for that online and in the merchant docs and the dev docs. So by default, we have profiles such as customers, products, categories, properties, orders, newsletters, promotions, and so on. So basically, any entity you might have in your old webshop, it can be moved to the new webshop. In general, we’re talking about fairly simple and flat data.

So as an example, let’s say I want to move my category tree that includes products with variants or configurable products. In general, what I would have to do is import the categories, then the products, and then the variants that come or the configurable options that come with that product. I’ll need to migrate the properties ahead as well. There are some relations, but it’s not like these relations are automatically created. So that’s something to keep in mind. It is fairly fast to use the entity repositories, under the hood, which means that while I’m importing a product, for example, all the event hooks and observers around our fire, that means that any plugin that might tap into the product is also fired.

So ultimately, I will get fairly decent performance on this, but it’s not as fast as data migration which we will go into in a bit. Like I said, there’s also an export option if you want to see, for example, the sample data what that looks like in this format. As a great addition to that, we can also create our own profiles that can either be done by adding them to a plugin as a developer or we used a no-code option. So we can create a new profile. We give it a name.

We give it the type of object that we want to import, such as customers, or promotions, or products. And from there, we can actually map the different columns in the CSV to the database fields. Again, it’s a no-code solution, so anyone can do this, and it makes it a very powerful tool to have in your arsenal. If you have new entities that you might have to create, right… in your own old platform, you have, for example, blog posts; through creating a plugin, we can actually create also a profile for that, there’s no-code solution for that, but it’s fairly low code. It’s fairly easy to do so. Anything can be imported through CSVs.

Data Migration Tool

Next up is, as I mentioned, the data migration tool. This tool is created for migrating data, its very fast, very performant and it comes highly configurable for developers. So we have a couple of profiles there that are already available. This is for Showpare 5. This is for Magento 1 and for Magento 2, these profiles can also be used to adapt to, for example, a WooCommerce profile or what have you. A little bit of effort. Profiles can also be easily extended. So we’ll cover all the basics, from products to promotions to shop settings whatsoever.

Let’s say you have your own custom entity types in your old shop and you want to migrate those to Shopware 6. You have to go in and extend those profiles, but again, there is extensive documentation around doing so, so that should not be a problem.

One of the more powerful options also supports deltas, meaning I can migrate up to a certain point, and then a few months later, I can go in and migrate the rest. So, for example, orders I can migrate up to April, and then from April, I can later on say I want to migrate the rest of the orders up to September, October, whatever. That’s very, very powerful.

It’s also the fastest option we have, simply because it circumvents some of the things that we built into Shopware 6 where it injects directly in the database. There is something to keep in mind in some cases, you might have a plugin that hooks into certain events on product or customer creation. Those would not be triggered. But in general, especially at the start of a project, this is the way to go to quickly migrate from the old platform to a new Shopware 6 installation already have your sales channels set up, your tax set up, your properties, categories and so on set up without too much hassle and too much time.

So what we offer, like I said, we migrate to full shops, anything from the catalog entities, to orders, customer settings, sales channels and store views. So this is a fairly easy way to migrate. We’ll come back in the tips and tricks on how to leverage this tool in a way where it causes minimal friction. Then the migration to itself under the hood basically consists of three parts. So we have the Reader. And the reader will take the data from Magento 1, Magento 2, or your own platform – a custom bespoke platform even. Take that into Shopware 6, and then we have converters that will actually convert this data to the standard format the Shopware 6 is accustomed to. So normally the heavy lifting, the business logic will be found in the converters, and obviously the writers that are writing this to the Shopware 6 database.

So if we are importing, for example, products and they are a standard production from a custom implementation, we would have to change the readers and the converter is not the writers. If we have extra fields in our products and we want to import those into Shopware 6, we would have to extend the reader, the converter, and the writer. So this would be a few more levels that we have to adjust. But it’s a fairly simple concept, and it’s also easy to work with for a developer.

API Layer Data Import

Then the last option is the API layer. So the API layer is not necessarily there, only to migrate data, right. We are built API first, we are a headless solution that also offers a frontend. The API layers, for example, are also used for the admin area, which is built on the VueJS. It’s used for a Shopware PWA, our PWA solution, but it can also be leveraged to import data or to connect to an ERP system or a PIM system, or what have you.

Like I said, we’re built API first. The good thing about this we have we have full API coverage. That means it’s all data and all logic within Shopware 6 is covered by this API there are no caveats, which means that any kind of data can be imported. It’s well-documented something called Swagger, which is a default method of documenting APIs. So any developer will find it easy to read through this, even if they have limited or no knowledge of Shopware 6, which is quite powerful. And then it’s great for complex data. So where we talked before about migrating certain entities. This is a great way to take very complex entities in your old system and move those Shopware 6. However, this takes a bit more, more effort. You’ll need to integrate that API layer with your own code. The good thing is this can be done in any programing language, so it’s not necessarily required to have a PHP developer. This can be anyone. And with this documentation, it should be fairly easy for them to get set up. We’ll get to this in a bit when we talk about some of the practice parts.