How is the data imported and exported in Shopware 6?
Import/export functions are used to maintain the required content in Shopware 6. This is the quickest and easiest way. You import the desired content into the shop system. It can then be read out via exports and transferred to interfaces. In this article, we explain what the import/export module is used for and how data is imported into and retrieved from the shop with the help of this module. You can use the export part with many different types of data, e.g. customer data, orders or products. You can export all products from the live shop and import them into a second shop (e.g. a staging environment for development purposes). Then the products do not have to be created from scratch. You can export them directly in one stage and import them again easily.
Requirements for the import
You can find the Shopware Import/Export module under Settings - Import/Export.
To import data, you need a CSV or XML file with the relevant data. Other important data is contained in the profile. Shopware explains what the data is and how to handle it. Shopware is already equipped with a standard profile for all common imported or exported data; if you want to import the product that does not yet exist in the shop, a profile must be created. If you want to create the data required for the import with the standard profiles, you can read the information about this in the Shopware documentation under "Documents".
There are examples for practically every standard profile. Download the CSV file.
The CSV file contains a single product. The first field "ID" is the unique UUID of the product. Based on this, the data can be matched. If you enter an ID for the existing product, an import will match the data with this existing product and thus update and overwrite the data for it. If you create a new product, you can leave the ID blank. If the ID is empty, the data will not match. In the case of an existing product, a new ID is assigned instead and a new product is created as a result; it should also be noted that each product requires a tax rate. The ID of the tax rate varies from shop to shop. It is created dynamically. This data set uses a tax rate of 7 %. Check whether your tax rate ID is also 7 %. Memorise the last four letters and numbers (46c4).
Then go to Tax settings. Click on "Reduced rate" and in the URL preview at the bottom left you will see that this tax rate ID does not match the ID attached in the CSV file. It ends in 3255, which is not a big problem, but it is better to change it. To do this, you need to copy the tax rate ID from the URL and paste it into the "tax_id" field. The rest of the data looks fine, no changes are required. Save the changes.
Detailed explanation of imports
Step 1
Select the previously downloaded and edited sample file.
Step 2
You must then select which profile is to be used in order to have the context for the data. In this case, it is the standard profile for products. Here you have the option of specifying whether or not you also want to import product variants into Shopware 6. The import can be restricted to main products.
Step 3
When you are ready, you can start the import immediately. There is also the option "Start test run". This function basically runs the entire import, but does not change or create anything in the shop. This should be a simulation of the import. It is very useful when importing large quantities. This way you can see if the import works the way you want it to. The errors in the file can lead to a partial import and a huge mess. As there is only a single file, you can start the Shopware 6 import immediately without a test run.
Step 4
The current import progress, including other imports that may have been started in the last 30 days, is visible below.
After the successful import, check whether the new product is available in the catalogues. Find SWTEST in the Shopware product overview and when you open it, you will see that it also uses the 7% tax rate.
Export - clear and simple
Step 1
Take a look at Shopware 6 Export. Go to Settings - Import/Export. Click on the second tab Export. Here you must first select a profile. It determines which data you want to export from the shop. Select the standard product here. Here you can determine whether the product variants must be exported to Shopware 6. You can then click on "Start export".
Step 2
You get an overview of all export activities of the last 30 days. Click on three dots and select "Download export data".
Step 3
You can see the exported products in the Shopware 6 export file. It contains their names, stock levels and descriptions. There are also the product IDs. If you edit something and want to re-import the file into the shop, the data is synchronised using these IDs. This would result in none of the products listed here being recreated because you already have these IDs for products in the shop. Instead, the existing products would be updated with the changes made here.
If you are going to delete them, enter an ID here and then import them again. Shopware would not have a product matching this ID and would choose to create a new product again, and that about covers it for export.
Profile
In the "Profiles" tab, you can check which profiles are used for import and export. They contain information about the database entries that can be accessed. You can copy the existing profile. To do this, click on three dots and select "Duplicate".
When creating a new profile, you should enter a name, technical name, object type and select the utilisation target. There are field indicators below. They determine which separators and enclosing characters are used for the individual fields.
In most cases, you can simply leave these at the default values, as used by the editors for editing CSV and XML files. If the settings are OK, click on "Next". In the next step, you should import a CSV file with the mappings for the database fields from another shop. The next menu offers all the required database mappings for the selected object type. The CSV name and database entry are required. The latter must have an equivalent in the respective database table in order to be able to import or export something. The default value is used if the import does not contain any data for this field. You can change the positions on the far right. The position determines the order of the assignments.
Once all the fields have been filled in, click on "Add profile". The profile is created and is available under the existing profiles. You can export it if required.
Practical tips for Shopware import/export processes
If shop operators want to import/export without the help of a specialised Shopware 6 Agency you have to be particularly careful. Some things must be observed at all costs, otherwise mistakes will happen. Our experts have prepared the most important recommendations for you.
Recommendations for creating a CSV file
- The CSV file must be UTF-8 compliant. As some programmes (Excel) do not support this encoding, the umlauts are encoded in a separate format.
- The character sets in the CSV file should be separated by semicolons.
- Inverted commas are required to interpret string separators.
Tips for carrying out imports
- When importing prices, full stops should be used instead of commas (3.00 instead of 3.00). Otherwise the price will be imported incorrectly.
- It is better to plan imports in several batches. This minimises the system load and monitors the data transfer quality. Adjustments must be made before processing large volumes of data.
Tips for successful export
- AI Copilot Export Assistant is available for Shopware Rise, Evolve, Beyond. When activating an AI-supported export assistant, you can only enter instructions to carry out export processes.
- When exporting the data, you should check whether the profile contains the following mandatory fields id, salesChannelId, orderDateTime, stateId. If these fields are missing, Shopware export will not take place.
What should you bear in mind when creating and customising profiles?
- It is important to choose the right profile. It contains information on how to insert the data into the database table.
- The system default language should be selected when creating new profiles. This also applies to profiles that must be valid for another language.
- Additional fields should be added to the import profile. This integrates customer-specific data or special product information.
- It is necessary to analyse the field mapping. Sensible field mapping contributes to efficient data integration into the shop system..
Tips for caching and scalability
- To optimise the performance of imports, you should use caching tools (Redis) and take advantage of Shopware 6 queue processing. As an expert in Shopware performance optimisation, Kenner Soft is here to help and advise you.
- Dank Queue-Verarbeitung werden Importaufgaben effizient abgewickelt, ohne Shop-Performance zu beeinträchtigen. Wenn ein Onlineshop über ein hohes Datenaufkommen und eine starke Kundenfrequenz verfügt, sollte man darauf besonders achten.