How to Configure Remote Attribute Based Shipping
This document provides a step-by-step guide on how to configure Remote Attribute Based Shipping Options in Commerce. This flow lets an external service decide how the quantities of each basket line are split into delivery groups at checkout (for example express, standart, global), while Commerce presents a separate, selectable shipping option for each group.
It is useful when grouping cannot be expressed by a static product attribute — most commonly when the same SKU must be fulfilled partly from a store (express) and partly from a warehouse (standart), including partial splits (e.g. of 7 units, 4 ship express and 3 standart).
1. Overview
When the customer reaches the shipping step, Commerce calls the configured remote service with the current basket and shipping address. The service responds with a list of groups; each group has a label (attributeValue) and an allocation describing how many units of each basket item belong to it. Commerce then shows one group per label, each with its own shipping options and fee, and lets the customer choose within every group.
Key characteristics:
Dynamic groups: the number of groups is not fixed — Commerce uses exactly the groups the service returns.
Basket is never mutated: the split is ephemeral; it is materialized into separate shipping groups only when the order is placed.
Per-group options and fees: each group is bound to its own shipping option(s) and price.
Non-blocking: if the service is unreachable, times out, or returns an invalid body, Commerce falls back to a single group so checkout is not interrupted.
The request/response contract of the remote service is documented in Remote Attribute Based Shipping Flows.
2. How groups connect to shipping options
This is the part that ties everything together. The remote service only returns group labels (express, standart, global, …) — it does not return any shipping company or price. The mapping from a group label to the shipping options shown for it lives entirely in Omnitron and is expressed with a single rule: the Attribute Based Shipping Group Rule.
For every group label the service can return, you create one (or more) Attribute Based Shipping Option records whose Rule is:
{
"name": "Attribute Based Shipping Group Rule",
"slug": "attribute-based-shipping-group-rule",
"group_value": "express"
}At checkout, for each group the service returns, Commerce evaluates the active Attribute Based Shipping Options and offers an option in that group only if its group rule's group_value equals the group's label. In other words:
The link between the remote value (
express/standart/global) and attribute-based shipping is thegroup_valuefield of the Attribute Based Shipping Group Rule — it must match the label the service returns, character for character.
A few consequences:
One option per group → one Attribute Based Shipping Option per label (each with its own calculator/fee).
Several choices in a group → several Attribute Based Shipping Options that share the same
group_value.An option for every group → give that option an Any Rule instead of a group rule; it will appear in all groups.
No product attribute is involved — unlike the standard attribute-based flow, the value is supplied by the remote service at runtime, not read from the product.
3. Setup
3.1. Enable the checkout page
Navigate to Sales Channels → Sales Channel Settings → Dynamic Settings, find CHECKOUT_SHIPPING_OPTION_SELECTION_PAGE, and set its value to:
Only one shipping option selection page can be active at a time.
3.2. Configure the remote provider
In the same Dynamic Settings screen, set REMOTE_ATTRIBUTE_BASED_SHIPPING_OPTION_PROVIDER with the provider class and the service credentials (URL, username, password) shared during integration:
klass
Provider implementation. Use the extension provider shown above.
conf.base_url
Base URL of the remote service (Commerce calls POST {base_url}/attribute-based-shipping-groups).
conf.username
Username for HTTP Basic authentication.
conf.password
Password for HTTP Basic authentication.
3.3. Define the shipping options (carriers)
Under Sales Channels → Sales Channel Settings → Shipping Options, create the carriers you will offer, one per choice you want the customer to see — for example Express Kargo, Standart Kargo, Global Kargo. Note each carrier's slug; you will need it in Step 3.5 for group surcharges. At this stage the Calculator and Rule on the shipping option itself are not important — the ones that matter are set on the Attribute Based Shipping Option in the next step.
3.4. Bind each group to its shipping options
Navigate to Sales Channels → Sales Channel Settings → Attribute Based Shipping Options and click + New Attribute Based Shipping Option. For each group label the remote service returns, add a record:
Shipping Option: the carrier from Step 3.3 to offer for this group.
Calculator: the fee for this group, e.g. a fixed price:
Rule: the Attribute Based Shipping Group Rule with
group_valueset to the group label:Set the status to active and save. Repeat for every group label, and add extra records for a label if you want more than one choice in that group.
3.5. (Optional) Add a surcharge to a group
To add a fee to a specific group — for example an import fee on global — do not set anything on the shipping option itself. Instead add an entry to the EXTRA_FEE_CONFIGURATIONS dynamic setting of type shipping_option, bound to that group's carrier slug. The fee amount is the price of the referenced fee product (sku); per_item controls whether it is charged per unit or once:
4. Worked example
Suppose the remote service can return three groups. You configure three Attribute Based Shipping Options (Step 3.4):
Group label (group_value)
Shipping Option
Calculator (fee)
express
Express Kargo
19.90
standart
Standart Kargo
29.90
global
Global Kargo
49.90
A customer adds 7 units of a product whose stock is split 4 (store) / 3 (warehouse). At checkout Commerce calls the remote service, which returns:
Commerce then presents two groups: express (4 units → Express Kargo, 19.90) and standart (3 units → Standart Kargo, 29.90). If the basket also contained a global product, a third global group (→ Global Kargo, 49.90 + the import fee from Step 3.5) would appear. The customer selects one option per group and continues; when the order is placed, each group becomes its own shipping group and the line's 7 units are materialized as 4 + 3 order items accordingly.
5. Verify
Send a request to the checkout shipping step and confirm the groups appear:
The page_context.attribute_based_shipping_options object contains one entry per group label, each listing its shipping options, the group's product_ids, and its allocation — a list of { "basket_item_id": <id>, "quantity": <n> } showing how many units of each basket item belong to that group. Select one option per group by posting a JSON map of group label → shipping option id:
After the order is created, verify that its order items are distributed across the expected shipping groups (one ShippingOptionGroup per group, with its amount).
6. Notes and limitations
The
group_valuein each Attribute Based Shipping Group Rule must exactly match a label the remote service returns; otherwise that group will have no options.Bundle (parent/child) and mergeable/unit-addable lines are not split; they are kept whole in a single group.
Cash on delivery (COD) needs extra configuration because a basket can use a different shipping option in each group. To offer COD only when the whole basket uses a single shipping option (for example only
expressor onlystandard), addSingleShippingOptionRuleto the COD payment option, with the shipping option slugs inslugs. The remote service must return those slugs as its group labels. To turn COD off for this flow instead, useShippingOptionPageRule. See Cash on Delivery (COD).
7. FAQ
Does every basket item have to be placed in a group? What about an item that belongs to no group (e.g. a gift card)?
No — you do not have to assign every item to a group. Any item you do not include in the allocation (or an item whose split is inconsistent) is placed whole, at its full quantity, into a fallback group whose label is None. So you can simply leave a gift card out of the allocation and it will land in the None group on its own. The only requirement is that the None group has a shipping option too: create an Attribute Based Shipping Option whose Group Rule group_value is None (or give one option an Any Rule so it appears in every group). Otherwise the None group is shown with no options and checkout cannot proceed for it.
A line has quantity 4. The service allocates 1 to express and 2 to standart, and 1 unit is not found anywhere (sum = 3 ≠ 4). What does Commerce do — does it drop the missing unit and reduce the line to 3?
No, the quantity is never reduced. When a line's allocation does not sum exactly to its quantity, the split is treated as inconsistent and discarded entirely: the whole line — all 4 units — is kept together and placed in the single None fallback group. The express/standart split for that line is not applied. In short, either the allocation sums exactly to the line quantity (then it is split), or the line is not split at all and stays whole in the None group. There is no "drop the missing unit" behavior.
Is the segment.name field in the request JSON null or the string "null" when there is no active segment?
JSON null. When there is no active segment, segment.name is sent as a JSON null, not the string "null".
Are the resulting shipping groups saved on the order automatically, or does the integration have to persist anything?
They are saved automatically. When the order is placed, Commerce creates one ShippingOptionGroup per group and assigns each order item to its group; the basket is not mutated beforehand. The integration does not persist anything on Commerce's side — it only has to return the allocation from the POST {base_url}/attribute-based-shipping-groups endpoint.
Last updated
Was this helpful?

