Browse Source

fix(core): Add check to fix transition from AddingItems with an empty order (#1736)

Alexander Shitikov 3 years ago
parent
commit
c33e407a59

+ 1 - 1
packages/core/src/service/helpers/order-state-machine/order-state-machine.ts

@@ -108,7 +108,7 @@ export class OrderStateMachine {
                 return `message.cannot-transition-from-arranging-additional-payment`;
             }
         }
-        if (fromState === 'AddingItems' && toState !== 'Cancelled') {
+        if (fromState === 'AddingItems' && toState !== 'Cancelled' && data.order.lines.length > 0) {
             const variantIds = unique(data.order.lines.map(l => l.productVariant.id));
             const qb = this.connection
                 .getRepository(data.ctx, ProductVariant)