CartTaxLine
Describes a cart tax line, including the tax rate and amount. This object provides detailed information about the tax applied to items in a cart, useful for calculating totals and displaying tax breakdowns in customer currency.
Type Definition
type CartTaxLine {
price: Float
rate: Float
ratePercentage: Float
}
Fields
Field | Type | Nullable | Description | Related Types |
---|---|---|---|---|
price | Float | Yes | Returns the price in the customer’s currency. Requires order context. | None |
rate | Float | Yes | Returns the tax rate as a decimal (e.g., 0.07 for 7%). | None |
ratePercentage | Float | Yes | Returns the tax rate as a percentage (e.g., 7.0 for 7%). | None |
Relationships
The CartTaxLine
type is a standalone object representing tax details associated with a cart. It does not directly reference other object types but is typically nested within cart-related queries or mutations that return tax information.
Usage Examples
Basic Query
{
cart(id: 98765) {
taxLines {
price
rate
ratePercentage
}
}
}
Field Selection
{
cart(id: 98765) {
taxLines {
price
ratePercentage
}
}
}
Nested Queries
{
cart(id: 98765) {
id
taxLines {
price
rate
}
lines {
id
quantity
merchandise {
id
price
}
}
}
}
Filtering and Sorting
The CartTaxLine
object itself does not support filtering or sorting directly as it is returned as part of the cart structure. Filtering and sorting should be applied on the parent cart or cart lines where applicable.
Implements
This type does not implement any interfaces.
Connections
CartTaxLine
is typically connected as a list field taxLines
within the Cart
object, representing all tax lines applied to the cart.
Related Types
Cart
: The parent object that containstaxLines
.CartLine
: Represents individual items in the cart, which contribute to the tax lines.
Best Practices
- Always check for nullability on
price
,rate
, andratePercentage
fields, as tax information may not be available in all contexts. - Use
rate
for precise tax calculations since it is represented as a decimal. - Use
ratePercentage
for display purposes in UI, as it is easier to interpret. - When querying tax lines, include the cart context to ensure currency and tax rates are accurate.
- Combine tax line data with cart line items for a full tax breakdown.
Notes
- The
price
field requires an order context to return the price in the customer’s currency; otherwise, it may be null. - Tax rates (
rate
andratePercentage
) are optional and may not be present if tax calculation is not applicable. - This API currently requires no authentication, but this may change in future versions.
- For performance, avoid requesting unnecessary fields if tax details are not needed.
- Tax calculations can be complex depending on jurisdiction; always use the provided tax lines for accurate totals rather than recalculating client-side.