Skip to main content

Drupal Commerce and Migrate status

Published on

First Steps

Plans were made back in December 2015 to put effort into the ability to support Migrate with Drupal Commerce to speed up adoption of Drupal Commerce 2.0. Commerce Migrate for Drupal 8 will provide migrations from Drupal Commerce 1.x, Ubercart for D6, and Ubercart for D7. Ideally, this module will also support other vendors, such as Magento and WooCommerce.

Before official work began on the 8.x branch, we had a contributor start with an Ubercart 6 port! Contributor creativepragmatic created a sandbox fork and commenced on the Drupal 8 work. The code as mentioned earlier has been working for creativepragmatic to continue development for their Drupal 6 to Drupal 8 site migration.

Midwest Drupal Camp

MidCamp kicked off the official start of the Commerce Migrate 8.x branch. This was the merger of creativepragmatic's work. I sprinted on creating a database test fixture for Commerce Migrate's tests. I chose the Commerce Kickstart 2 demonstration store as our test base! So that means all tests are proving we can migrate a Commerce Kickstart 2 demo site to Drupal Commerce 2.x. Work was somewhat slow and stopped short, as 8.1.x was pending to be released and saw a change to how Migrate worked: "Migrations are plugins instead of configuration entities." We left MidCamp, however, with the database test fixture and initial tests and migration components.

DrupalCon New Orleans

Work on Commerce Migrate remained on pause until DrupalCon New Orleans. By this time Drupal 8.1.1 was released and the Migrate module was slightly more mature. Our focus during the conference was to push forward the Commerce 1.x to Commerce 2.x migration path since there is a method to test it.

During DrupalCon, a few conference goers approach the booth with questions about Ubercart D6 to Commerce 2.x sites. As mentioned previously, creativepragmatic wrote the initial code. Until there is a sanitized sample dataset, we cannot fully work on the Ubercart migrations or guarantee them. (If you have data you would like to contribute, please contact me!)

Headway was made, however, on the Commerce 1.x migration front. Tests have updated to the kernel test format, a change in Migrate. These tests are now passing on billing profile, line item, and product (variations in 2.x) and product type entities. A process plugin to handle migrating Commerce Price fields from 1.x to 2.x was added and is running on product and line item values. Other fields do not yet to have a supported migration.

What is next?

The next steps are to provide a process plugin to migrate Addressfield field data to the field provided by Address. We also must create process plugins for each of the reference fields provided by Commerce 1.x: product, profile, and line item. With these items completed, orders will be able to be completely migrated.

The largest task will be the migration of Commerce 1.x product displays to Commerce 2.x product entities. This requires finding nodes that have a product reference field.

While migrating from an existing site and data might not quite work, yet, you can start using Migrate to import data. See the Commerce Demo module I am working on: https://github.com/mglaman/commerce_demo. It provides an example of importing a CSV that you might receive from an ERP/PIM and creates Drupal Commerce products, variations, and attributes.

Also, check out creativepragmatic's original work, which has some documentation on initial migration gotchas: https://github.com/creativepragmatic/commerce_migrate

I'm available for one-on-one consulting calls – click here to book a meeting with me 🗓️