Bulk Add Tax Items to Cart
POST/v2/carts/:cartID/taxes
Use this endpoint to bulk add tax items to cart items and bundle component products.
A cart item can only have a maximum of five tax items. A bundle component product can only have a maximum of five tax items.
Bundle Component Taxes
To add tax items to bundle component products, include a meta object with component_product_id in each tax item:
{
"data": [
{
"type": "tax_item",
"code": "GST",
"name": "Goods and Services Tax",
"rate": 0.1,
"meta": {
"component_product_id": "12345678-1234-5678-9012-123456789012"
},
"relationships": {
"item": {
"data": {
"type": "cart_item",
"id": "cart-item-id"
}
}
}
}
]
}
Errors
422 Unprocessable Entity
In this example, when options.add_all_or_nothing is set to true and if
one of cart items is not found or has reached its maximum tax item limit,
the following error response is returned:
{
"status": 422,
"title": "Add all or nothing.",
"detail": "Add all or nothing set to (true). Could not bulk add tax items to cart."
}
In this example, if you add more than five tax items to the same cart item, the following error response is returned:
{
"status": 422,
"title": "Tax item not added to cart item.",
"detail": "Cannot exceed tax item limit of (5) on cart item.",
"meta": {
"id": "f88e6370-cb35-40b2-a998-c759f31dec0a"
}
}
404
In this example, if there is a mismatch between cart_item/custom_item
and the relationships.item.data.type specified in the bulk add tax item,
the following error response is returned:
{
"data": [],
"errors": [
{
"status": 404,
"title": "Tax item not added to cart item.",
"detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).",
"meta": {
"id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d"
}
},
{
"status": 404,
"title": "Tax item not added to cart item.",
"detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).",
"meta": {
"id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d"
}
}
]
}
Request
Responses
- 200
- 201
- 422
Response Headers
Created
Unprocessable Entity