Skip to content

Commit

Permalink
fix(core): Fix deleted product option groups can't be deleted again (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
seminarian authored Apr 3, 2024
1 parent 969b72c commit 16add4a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/core/src/service/services/product.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,16 @@ export class ProductService {
return variantResult;
}
for (const optionGroup of product.optionGroups) {
const groupResult = await this.productOptionGroupService.deleteGroupAndOptionsFromProduct(
ctx,
optionGroup.id,
productId,
);
if (groupResult.result === DeletionResult.NOT_DELETED) {
await this.connection.rollBackTransaction(ctx);
return groupResult;
if (!optionGroup.deletedAt) {
const groupResult = await this.productOptionGroupService.deleteGroupAndOptionsFromProduct(
ctx,
optionGroup.id,
productId,
);
if (groupResult.result === DeletionResult.NOT_DELETED) {
await this.connection.rollBackTransaction(ctx);
return groupResult;
}
}
}
return {
Expand Down

0 comments on commit 16add4a

Please sign in to comment.