Skip to content

Commit 81ad5e1

Browse files
Fix quotes unit multiplier calculation
1 parent 2480b9d commit 81ad5e1

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

CHANGELOG.md

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

88
## [Unreleased]
99

10+
### Changed
11+
- Fixed originalSubtotal calculation to include unitMultiplier in QuoteDetails and QuoteChildren
12+
1013
## [3.0.6] - 2026-01-29
1114

1215
### Changed

react/components/QuoteDetails/QuoteChildren.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ interface Props {
2525
permissions: string[]
2626
usingParentQuote: boolean
2727
usingQuoteChild?: string
28+
unitMultipliers?: Record<string, number>
2829
}
2930

3031
const QuoteChildren: React.FC<Props> = ({
@@ -34,6 +35,7 @@ const QuoteChildren: React.FC<Props> = ({
3435
permissions,
3536
usingParentQuote,
3637
usingQuoteChild,
38+
unitMultipliers,
3739
}) => {
3840
const { culture, navigate } = useRuntime()
3941
const intl = useIntl()
@@ -62,9 +64,12 @@ const QuoteChildren: React.FC<Props> = ({
6264
const originalSubtotal = useMemo(
6365
() =>
6466
(items ?? []).reduce((acc, item) => {
65-
return acc + item.price * item.quantity
67+
const multiplier =
68+
unitMultipliers?.[item.id] ?? item.unitMultiplier ?? 1
69+
70+
return acc + item.price * item.quantity * multiplier
6671
}, 0),
67-
[items]
72+
[items, unitMultipliers]
6873
)
6974

7075
const discount = useMemo(

react/components/QuoteDetails/QuoteDetails.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,8 @@ const QuoteDetails: FunctionComponent = () => {
606606
}
607607

608608
const price = quoteState.items.reduce(
609-
(sum: number, item: QuoteItem) => sum + item.price * item.quantity,
609+
(sum: number, item: QuoteItem) =>
610+
sum + item.price * item.quantity * (unitMultipliers[item.id] ?? 1),
610611
0
611612
)
612613

@@ -916,6 +917,7 @@ const QuoteDetails: FunctionComponent = () => {
916917
usingQuoteChild={usingQuoteChild}
917918
handleUseQuote={handleUseQuote}
918919
permissions={permissions}
920+
unitMultipliers={unitMultipliers}
919921
/>
920922
))
921923
) : (

0 commit comments

Comments
 (0)