Browse Source

fix(core): Correctly compare falsy customField values in OrderLines

Michael Bromley 4 years ago
parent
commit
265781ca14

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

@@ -480,7 +480,7 @@ export class OrderModifier {
         for (const def of customFieldDefs) {
         for (const def of customFieldDefs) {
             const key = def.name;
             const key = def.name;
             const existingValue = existingCustomFields?.[key];
             const existingValue = existingCustomFields?.[key];
-            if (existingValue) {
+            if (existingValue !== undefined) {
                 const valuesMatch =
                 const valuesMatch =
                     JSON.stringify(inputCustomFields?.[key]) === JSON.stringify(existingValue);
                     JSON.stringify(inputCustomFields?.[key]) === JSON.stringify(existingValue);
                 const undefinedMatchesNull = existingValue === null && inputCustomFields?.[key] === undefined;
                 const undefinedMatchesNull = existingValue === null && inputCustomFields?.[key] === undefined;