fix(product, utils): handle metadata key deletion on product update (#12478)
This commit is contained in:
@@ -6,6 +6,8 @@ import {
|
||||
buildQuery,
|
||||
DALUtils,
|
||||
MedusaError,
|
||||
isPresent,
|
||||
mergeMetadata,
|
||||
} from "@medusajs/framework/utils"
|
||||
import { SqlEntityManager, wrap } from "@mikro-orm/postgresql"
|
||||
|
||||
@@ -148,6 +150,10 @@ export class ProductRepository extends DALUtils.mikroOrmBaseRepositoryFactory(
|
||||
)
|
||||
}
|
||||
|
||||
if (isPresent(productToUpdate.metadata)) {
|
||||
productToUpdate.metadata = mergeMetadata(product.metadata ?? {}, productToUpdate.metadata)
|
||||
}
|
||||
|
||||
wrappedProduct.assign(productToUpdate)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user