Add tax calculation #1
+10
@@ -0,0 +1,10 @@
|
|||||||
|
import { totalCents, type CartItem, type Discount } from './cart'
|
||||||
|
|
||||||
|
export function totalWithTaxCents(
|
||||||
|
items: CartItem[],
|
||||||
|
taxRatePercent: number,
|
||||||
|
discount?: Discount,
|
||||||
|
): number {
|
||||||
|
const base = totalCents(items, discount)
|
||||||
|
return base + base * (taxRatePercent / 100)
|
||||||
|
|
|||||||
|
}
|
||||||
Reference in New Issue
Block a user
This returns fractional cents - needs rounding