How to Filter Products In Shopware 6 Import & Export

- Our extensions, Shopware

Data filtering is a handy improvement to standard import and export processes. It helps you transfer only the necessary information without additional manual editing. As a result, your standard import and export workflow is dramatically improved. While different e-commerce platforms offer different filtering options, Shopware 6  provides fairly limited opportunities in this area. Below, we shed light on how to filter products in Shopware 6 import and export. We explore a Stack Exchange discussion and share our unique experience in this area. Also, don’t forget to check our Shopware Cookbook for additional materials.  

Shopware 6 Import & Export Profiles

Claudiu Stoica asks how to filter products by category in a Shopware 6 import/export profile to avoid importing/exporting ALL products. Initially, this profile has been created with the help of API with the following body of the request:

Shopware 6 profile and existing endpoint limitations

According to Dneustadt, it is currently impossible due to the limitations associated with the profile you create and existing endpoints. 

Custom API endpoints 

However, it is possible to overcome the existing limitations by using a custom API endpoint.

You’ll have to implement a custom API endpoint.

Use your admin API credentials to request the following endpoints in that order with the respective payloads:

Where:

  • profileId is the id of the profile you want to use for exporting. 
  • expireDate is a date after which the export would be deemed expired and ready to be deleted. 
  • file is a parameter that contains the file you’re trying to import, but since you want to export you just omit it.

This endpoint returns logId required in the next step.

Request this endpoint with the logId from the prior request to start export/import. Since it runs in the message queue, you’ll have to wait for the process to finish.

Next, you can utilize the search endpoint for the import_export_log entities with the logId you received previously as a filter. Do so to check the state of the process. You will be able to proceed once it is finished. You’ll also need the fileId from this record for the download.

Use the fileId to request this endpoint. You will get accessToken in return necessary for the final request.

Streamline both fileId and accessToken from earlier to request this endpoint which should yield a download stream of the exported file.

However, if you want to implement filters for Shopware 6 export, you will need to request your new custom endpoint instead of starting the process using the existing endpoint when you first retrieve logId. The implementation could look as follows:

After calling your custom endpoint proceed with the steps described earlier.

Custom API endpoint limitation

Unfortunately, this method doesn’t work for everyone. If you are going to build an app, it won’t work simply because you won’t be able to create the controller. So, how to address this issue?

Firebear’s Import and Export Filters and Conditions

Our team has a vast experience in data transfers. We started as a Magento company and then moved to new directions, using the existing experience. And export filters were among the important features of our Improved Import & Export extension. With the module’s help, you can quickly narrow down the selection of items you want to export. At the same time, it could possibly filter out a massive data scope to help you import only those items that you really need. Let’s take a look at the import and export filtering capabilities separately. Bear in mind, that we can help you implement similar features in the Improved Import, Export, and Mass Actions app for Shopware 6. Contact us for more information.

How to create Shopware 6 export filters

You can use the Improved Import, Export & Mass Actions application for Shopware 6 to extend the default data transfer capabilities of the platform. Although this solution doesn’t use filters, we describe how a basic export filter works in Magento 2. However, we can implement something similar for Shopware 6. 

In Magento, you can get the export filtering done as follows:

  1. Create a new export profile and proceed to the filter tab. Click the ‘Add Filter’ button there;
  2. Select an entity chosen in the ‘Export Behaviour’ section;
  3. Next, specify a basis for a new filter. Select a system attribute in the ‘Field’ column. It will be used to narrow down the selection of exported items;
  4. After that, specify the parameters that will be applied for filtering.

Now, you can repeat these steps to create more filters. Note that parameters applied for filtering vary, depending on the selected attribute.

The following gif image illustrates how to narrow down the selection of exported orders by applying a filter on the basis of their subtotal. 

Select ‘Orders’ in the ‘Entity’ column, specify the ‘subtotal’ attribute in the ‘Field’ column, and set a range in ‘Filter’. 

Contact us regarding the implementation of similar export filters for Shopware 6.

How to create Shopware 6 import filters

Import filters address a slightly distinct set of challenges. The issue is that because third-party systems employ specific attribute standards, you cannot just take any data file and build filters and conditions based on external attributes.

It isn’t even a feature that is very demanding, though. Therefore, we haven’t implemented it in the Improved Import & Export extension yet, not to mention the Improved Import, Export & Mass Actions application for Shopware 6. While the module offers robust mapping capabilities, it doesn’t let you use filters on import. But if there are enough clients willing to implement this functionality, we will add this feature to our update schedule. 

To get more information about Shopware 6 import filters and conditions, please, contact our help center. Use the following link: Firebear Help Center

Other Advanced Import & Export Features for Shopware 6

The Improved Import, Export, & Mass Actions application enables you to address the most frequent problems with Shopware 6 data transfers. Thanks to the full support for product properties, you can not only manage your catalog quickly in a spreadsheet editor and re-import it, but you can also automate various repetitive tasks related to data transfers. The following are additional key benefits of our app:

  • Product import and export with full support for properties (attributes);
  • Customer import and export with full support for addresses;
  • Orders export;
  • Full support for product variants with a full set of attributes;
  • Product properties mapping with mapping presets;
  • Import and export schedules;
  • Import and export of CSV, XLSX, and XLSX files;
  • Direct file uploads;
  • FTP/FTPS uploads.

You can find more information about the Improved Import, Export & Mass Actions app here: