Skip to content

Commit 3b9e759

Browse files
authored
fix(plugin-ecommerce): variants validateOptions errors with SQLite when creating a new variant (#14054)
Fixes #13993 The PR makes it so we add the `not_equals` query constraint only if we have `data.id` (which we don't have when creating a new variant).
1 parent 9c08fb8 commit 3b9e759

File tree

1 file changed

+5
-3
lines changed
  • packages/plugin-ecommerce/src/collections/variants/createVariantsCollection/hooks

1 file changed

+5
-3
lines changed

packages/plugin-ecommerce/src/collections/variants/createVariantsCollection/hooks/validateOptions.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ export const validateOptions: (props?: Props) => Validate =
2929
joins: {
3030
variants: {
3131
where: {
32-
id: {
33-
not_equals: data.id, // exclude the current variant from the search
34-
},
32+
...(data.id && {
33+
id: {
34+
not_equals: data.id, // exclude the current variant from the search
35+
},
36+
}),
3537
},
3638
},
3739
},

0 commit comments

Comments
 (0)