Do not migrate line items for orders which are not migrated

Created on 23 March 2021, over 3 years ago
Updated 14 April 2024, 5 months ago

Problem/Motivation

The Commerce v1 migration only migrates completed orders, it doesn't migrate orders that are currently in checkout or active carts. However, it does migrate line items for these orders. This can leave loads of invalid line_item records behind.

Proposed resolution

Filter the migration to exclude line items for orders which are not migrated.

Remaining tasks

Work out a fix for this.
Add test coverage.

User interface changes

n/a

API changes

TBD

Data model changes

TBD

✨ Feature request
Status

Needs work

Version

4.0

Component

Drupal Commerce 1.x

Created by

πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Tried the patch, but didn't seem to remove all cart line items. Still had order items with null order_id.

  • I found this to be more dependable:

        // Join the order table and skip all items from orders that are carts.
        $query->leftjoin('commerce_order', 'o', 'o.order_id = li.order_id');
        $query->addField('o', 'status', 'o_status');
        $query->condition('o.status', 'checkout_checkout', 'NOT IN');
        $query->condition('o.status', 'checkout_shipping', 'NOT IN');
        $query->condition('o.status', 'checkout_review', 'NOT IN');
        $query->condition('o.status', 'cart', 'NOT IN');
  • First commit to issue fork.
  • Status changed to Needs work 5 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    I ran the new source plugin test without the fix and the test passed. I have not investigated but I am setting to NW.

Production build 0.71.5 2024