Tax Calculation
How tax is calculated on orders.
Updated
On this page
How Tax is Calculated
Tax calculation in DashForDevs follows these steps:
- Determine destination state from shipping address
- Look up tax rate for the state (configured in dashboard)
- Check product tax classes — different product types may have different rates
- Check legality — some products may not be legal in certain states
- Calculate per-item tax and return breakdown
Tax in Checkout
Tax is automatically calculated during checkout based on the shipping address:
// Tax is included in the checkout response
const { order } = await dash.checkout.complete({
cartId: dash.cart.cartId,
shipping: { state: "TX", ... },
// ...
})
console.log(order.tax) // "5.25" — automatically calculated
Displaying Tax Before Checkout
// Calculate tax to show in cart summary
const taxResult = await dash.tax.calculateForCart("TX")
const taxAmount = dash.tax.getTotal(taxResult)
// Display in cart
<div>
<p>Subtotal: ${subtotal}</p>
<p>Tax: ${taxAmount.toFixed(2)}</p>
<p>Total: ${(Number(subtotal) + taxAmount).toFixed(2)}</p>
</div>
Configuring Tax Rates
Tax rates are set in the dashboard under Settings → Tax. Configure rates per state and per product tax class.
Next Steps
- Tax Rates — Rate configuration
- Create Order — Tax in checkout flow