fix(product, utils): handle metadata key deletion on product update (#12478)

This commit is contained in:
Frane Polić
2025-05-21 21:32:12 +02:00
committed by GitHub
parent 4e49cebcf0
commit c5a6573e26
5 changed files with 18 additions and 54 deletions
@@ -1912,7 +1912,7 @@ medusaIntegrationTestRunner({
const payload = {
metadata: {
"test-key": "",
"test-key": "", // item is deleted by setting to empty string
"test-key-2": null,
},
}
@@ -1924,13 +1924,11 @@ medusaIntegrationTestRunner({
)
expect(response.status).toEqual(200)
expect(response.data.product.metadata).toEqual(
// BREAKING: Metadata updates are all-or-nothing in v2
{
"test-key": "",
"test-key-2": null,
}
)
expect(response.data.product.metadata).toEqual({
// "test-key" is deleted
"test-key-2": null, // updated
"test-key-3": "test-value-3", // preserved
})
})
it("updates products sales channels", async () => {