Skip to content

Commit 4ca150b

Browse files
Fix unit multiplier
1 parent 2480b9d commit 4ca150b

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Quote creation and update now correctly includes unitMultiplier in items sent to backend, ensuring accurate subtotal calculations for products with unitMultiplier values different from 1
13+
1014
## [3.0.6] - 2026-01-29
1115

1216
### Changed

react/components/QuoteDetails/QuoteDetails.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,16 @@ const QuoteDetails: FunctionComponent = () => {
274274

275275
setUpdatingQuoteState(true)
276276
const { referenceName, items: quoteItems } = quoteState
277+
278+
// Add unitMultiplier to items (keep sellingPrice as unit price)
279+
const itemsWithMultipliers = quoteItems.map((item: QuoteItem) => ({
280+
...item,
281+
unitMultiplier: unitMultipliers[item.id] ?? 1,
282+
}))
283+
277284
const cart = {
278285
referenceName,
279-
items: quoteItems,
286+
items: itemsWithMultipliers,
280287
subtotal: updatingSubtotal,
281288
note: noteState,
282289
sendToSalesRep,
@@ -364,10 +371,18 @@ const QuoteDetails: FunctionComponent = () => {
364371

365372
const itemsChanged = !arrayShallowEqual(data.getQuote.items, _items)
366373

374+
// Add unitMultiplier to items if they changed (keep sellingPrice as unit price)
375+
const itemsWithMultipliers = itemsChanged
376+
? _items.map((item: QuoteItem) => ({
377+
...item,
378+
unitMultiplier: unitMultipliers[item.id] ?? 1,
379+
}))
380+
: undefined
381+
367382
updateQuote({
368383
variables: {
369384
id: _id,
370-
...(itemsChanged && { items: _items }),
385+
...(itemsChanged && { items: itemsWithMultipliers }),
371386
...(itemsChanged && { subtotal: updatingSubtotal }),
372387
...(noteState && { note: noteState }),
373388
decline: false,

0 commit comments

Comments
 (0)