[**@bondsports/general**](../README.md) • **Docs**

***

[@bondsports/general](../globals.md) / calculateUnitPriceFromTotalWithTaxes

# Function: calculateUnitPriceFromTotalWithTaxes()

> **calculateUnitPriceFromTotalWithTaxes**\<`T`\>(`totalPrice`, `taxes`?, `quantity`?, `unitPriceHint`?): `number`

Calculates the unit price before taxes from the total price including taxes.
If all taxes have amounts, we use them to calculate the unit price.

## Type Parameters

• **T** *extends* [`CalculatedTax`](../type-aliases/CalculatedTax.md)\<[`ITaxBase`](../interfaces/ITaxBase.md)\>

## Parameters

• **totalPrice**: `number`

The total price including taxes.

• **taxes?**: `T`[]

The taxes to apply.

• **quantity?**: `number` = `DEFAULT_QUANTITY`

The quantity of items (default: DEFAULT_QUANTITY).

• **unitPriceHint?**: `number`

The original unit price to use when it reproduces the rounded total.

## Returns

`number`

The unit price before taxes.

## Defined in

[utils/price.util.ts:333](https://github.com/Bond-Sports/bondUtils/blob/545f16ceb055481acfd7641d7809c0f252d3a5e6/packages/general/src/utils/price.util.ts#L333)
