Remote Attribute Based Shipping Flows
This part of the document describes the remote service that powers Remote Attribute Based Shipping Options. During checkout, Commerce calls this service to learn how the quantities of each basket line should be split into delivery groups (for example express, standart, global). The number of groups is not fixed — Commerce uses exactly the groups the service returns.
The basket is never mutated: the split returned here is ephemeral and is materialized into separate shipping groups only when the order is created.
2 configuration parameters will be shared during integration:
password
Password for basic authentication
These credentials, together with the service base URL, are configured on the Commerce side through the REMOTE_ATTRIBUTE_BASED_SHIPPING_OPTION_PROVIDER dynamic setting.
attribute-based-shipping-groups (POST)
This service returns the delivery-group allocation for the current basket. It is called after the shipping address is selected and before the shipping options are presented to the customer.
URL
^^/attribute-based-shipping-groupsRequest Headers
x-akinon-api-version
Akinon Customer API version.
Mandatory
Authorization
Basic [BASE64_encoded(username:password)]
Mandatory
Request Body raw (json)
{
"basket": {
"pk": 12345,
"version": "3",
"currency": "try",
"totalAmount": "749.70",
"basketItems": [
{
"pk": 30928,
"version": "1",
"quantity": 7,
"price": "107.10",
"totalAmount": "749.70",
"product": {
"pk": 30928,
"name": "Decorative Object",
"sku": "8KKST6560XSTDSTD",
"price": "107.10",
"attributes": { "is_global": "false", "brand": "Acme" },
"stock": { "extra_field": { "warehouse_stock": 3, "store_stock": 4 } }
}
}
],
"discounts": []
},
"shippingAddress": {
"shipmentId": "9876",
"locale": "tr_TR",
"deliveryNote": "",
"type": "customer",
"destination": {
"name": "",
"surname": "",
"tel": "",
"country": { "id": 1, "code": "tr", "name": "Türkiye" },
"city": { "id": 34, "name": "İstanbul" },
"district": { "id": 456, "name": "Kadıköy" },
"township": { "id": 789, "name": "Moda" },
"zipcode": "34710",
"addressLine": ""
}
},
"segment": {
"name": "B2B",
"price_list_id": 7,
"stock_list_id": 9
}
}basket.basketItems[].sku
Product SKU; use it to look up stock locations / global products.
basket.basketItems[].quantity
Total quantity of the line in the basket.
basket.basketItems[].product.attributes
Product attributes (key/value), e.g. to detect global products.
basket.basketItems[].product.stock.extra_field
extra_field of the stock record the line resolves to — the per-stock-list ExtraProductStock when the checkout uses a stock list, otherwise the default ProductStock. Use it to split the line across stock locations. {} when the stock record has none.
shippingAddress.destination
Full shipping address for location-aware allocation.
segment.name
Name of the active customer segment (null if none).
segment.price_list_id
Price list id used for this checkout (segment or default inventory strategy).
segment.stock_list_id
Stock list id used for this checkout — use it to resolve per-location stock.
Response Body raw (json)
The service returns a list of groups. Each group has a attributeValue (the group label, e.g. express) and an allocation that lists, per basket item, how many units belong to that group. The sum of a basket item's quantities across all groups must equal that item's quantity.
groups[].allocation[].basketItemPk
The pk of a basket item from the request.
groups[].allocation[].quantity
Number of units of that basket item that belong to this group. Must be >= 1.
Notes
Global products (separated by SKU / product attribute) can be placed wholly into a dedicated group (for example
global); their import fee is handled separately by Commerce through the extra-fee configuration.Express / Standard typically split the same SKU by stock location (store vs. warehouse), so a single line can appear in more than one group (e.g. 4 units
express+ 3 unitsstandart).Consistency: for every basket item,
sum(allocation.quantity) == quantity. If a line's allocation is inconsistent (or the line is a bundle / mergeable line that must not be split), Commerce keeps it whole in a single group.Availability: if the service is unreachable, times out, or returns an invalid body, Commerce falls back to a single group so checkout is not interrupted.
Caching: Commerce caches a successful response for ~15 minutes while the basket (its version) and shipping address are unchanged; any basket change (add/remove/quantity) invalidates it. Empty/failed responses are not cached.
Last updated
Was this helpful?

