Configuring Adjustment - Fabric
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
This feature in Carts API provides you the flexibility to apply adjustments at the cart, item, or fulfillment level. Adjustments are deductible elements that modify the total amount and are non-taxable.
Prerequisites
The following prerequisites must be completed sequentially to configure an adjustment.
- Create a cart.
- Create a fulfillment to add a fulfillment adjustment.
- Create an item to add an item adjustment.
Adjustment Initialization
You can apply adjustments at multiple levels, including the cart, individual items, or fulfillment. The adjustment maintains a consistent structure across all levels. The following code sample provides the structure of an adjustment object:
{
"id": "6964b984-49fd-4754-b979-a260e944320c",
"price": {
"amount": 10
},
"reason": "DelayedOrder",
"attributes": {
"reasonDescription": "Price Adjustment due to delayed shipping"
},
"updatedAt": "2024-06-20T08:09:58.951Z",
"createdAt": "2024-06-20T08:09:58.951Z"
}
As multiple adjustments can be applied to a single cart, item, or fulfillment, adjustments are displayed as a collection. The following code sample provides the structure of an adjustment object in a collection:
"adjustments": {
"total": 10,
"collection": [
{
"id": "6964b984-49fd-4754-b979-a260e944320c",
"price": {
"amount": 10
},
"reason": "DelayedOrder",
"attributes": {
"reasonDescription": "Price Adjustment due to delayed shipping"
},
"updatedAt": "2024-06-20T08:09:58.951Z",
"createdAt": "2024-06-20T08:09:58.951Z"
}
]
}
Examples
Making adjustments at the cart level
Use the create cart adjustment endpoint to make adjustments at the cart level and credit points available for discounts as in the following example:
curl --location '{{modular_cart_domain}}/carts/7d403833-8e0c-43f5-aded-72d6a2eaf062/adjustments' \
--header 'Content-Type: application/json' \
--header 'x-fabric-tenant-id: {tenantId}' \
--data '{
"price": {
"amount": 10
},
"reason": "Avail 1000 Credit Points"
}'
Using adjustments at the item level
Use the create item adjustment endpoint to make adjustments at the item level and apply the sale price as in the following example:
curl --location '{{modular_cart_domain}}/carts/7d403833-8e0c-43f5-aded-72d6a2eaf062/items/806d6671-801d-4554-976d-0d38e525a852/adjustments' \
--header 'Content-Type: application/json' \
--header 'x-fabric-tenant-id: {tenantId}' \
--data '{
"price": {
"amount": "10"
},
"reason": "Item was a sale item 2 days ago",
"attributes": {
"type": "retail"
}
}'