Skip to main content

calculateTax

Requires permission products:tax:read.

Calculates the tax on a base amount for a tax group, specific tax rates or a location, and saves nothing. Requires permission to read tax.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

mutation CalculateTax($input: TaxCalculationInput!) {
calculateTax(input: $input) {
baseAmount
finalAmount
totalTaxAmount
taxBreakdown {
taxCode
taxName
calculationMethod
rate
taxAmount
taxRateId
}
}
}

Variables:

{
"input": {
"baseAmount": 0
}
}

Response:

{
"data": {
"calculateTax": {
"baseAmount": 0,
"finalAmount": 0,
"totalTaxAmount": 0,
"taxBreakdown": [
{
"taxCode": "string",
"taxName": "string",
"calculationMethod": "ADDITIVE",
"rate": 0,
"taxAmount": 0,
"taxRateId": "string"
}
]
}
}
}
calculateTax(
input: TaxCalculationInput!
): TaxCalculation!

Arguments​

calculateTax.input ● TaxCalculationInput! non-null input​

The base amount and what to tax it by: a tax group, tax rates, or a location, with optional product categories and currency.

Type​

TaxCalculation object​

The tax worked out on an amount.