Functionality for importing and exporting products is not built into Drupal Commerce core. This section describes how various Drupal contrib modules can be used to extend Drupal Commerce for importing and / or exporting products. See Extending Drupal Commerce documentation for information on how Drupal Commerce can be extended with additional modules.
The Commerce Feeds module can be used to import data in a variety of formats into Products, using the administrative interface. Unfortunately, it is not yet fully ported into Drupal 8. It is built on top of the Feeds module, which does have a pre-release version for Drupal 8 as well as documentation pages. If you are interested on working to develop the Drupal 8 version of Commerce Feeds, this issue has been opened, with a link to the work that has been done so far.
If you are comfortable writing custom code for importing products, then the Commerce Migrate module is a good place to start. There is a version for Drupal 8, documentation, and an explanation of the differences between using Feeds vs. using Migrate for importing products.
You can use the Views data export module to provide product export functionality. If you are unfamiliar with using
Views in Drupal, start by reading about Creating Listings with Views, in the Drupal 8 User Guide.
Here is an example of using Views data export for exporting products:
$composer require drupal/views_data_export --prefer-dist
Add all the product and variation fields you want to export.
If you want to add any Exposed filter criteria (so that users can specify subsets of products to be exported), make sure you check the Remember Last Selection option for those exposed filters.
/admin/commerce/product-exportso that Breadcrumbs will work correctly and set Access to a permission like Access the products overview page to control access to the product export page.
Under the FORMAT section of the view settings, click on the Settings link for the Format. Specify the format and optional settings for the data export.
After saving all your changes, you should be able to navigate to your new Product export view page and see a CSV (or other format) button in the lower left-hand corner of the page. Users with access to this page will be able to click on that button to export product data.
In the next section, we'll look at image management in Drupal.
Found errors? Think you can improve this documentation? edit this page