fix(medusa): quantity prices for line item updates (#5137)

* initial code push

* update metadata and only merge if the existing line item allows merging

* update should_merge check

* undo changes to taxrate service

* update results with unit pricing corresponding to the db values after update

* add should_merge property to line_item creation

* add should_merge property to line_item creation

* fix unit tests

* undo adding "should_merge" to create-line-item

* undo change to "addOrUpdateLineItem"

* :wqh_merge from generate method

* undo changes to unit tests

* revert to adding pricing in updateLineItem method

* update cart service test

* Create funny-radios-juggle.md

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Philip Korsholm
2023-09-28 14:26:58 +02:00
committed by GitHub
parent f88e3865a0
commit 2b91049f58
11 changed files with 202 additions and 20 deletions

View File

@@ -531,6 +531,33 @@ module.exports = async (dataSource, data = {}) => {
variant_id: "test-variant-quantity",
})
const quantityVariant1 = manager.create(ProductVariant, {
id: "test-variant-quantity-1",
title: "test variant quantity 1",
product_id: "test-product",
inventory_quantity: 1000,
options: [
{
option_id: "test-option",
value: "Fit",
},
],
})
await manager.save(quantityVariant1)
await manager.insert(MoneyAmount, {
id: "test-price_quantity-1.5",
currency_code: "usd",
amount: 950,
})
await manager.insert(ProductVariantMoneyAmount, {
id: "pvma-quantity-1.5",
money_amount_id: "test-price_quantity-1.5",
variant_id: "test-variant-quantity-1",
})
await manager.insert(MoneyAmount, {
id: "test-price_quantity-2",
currency_code: "usd",