# Bundle Order Data for 3PLs, ERPs, and OMS

> Exactly what a Flex Bundles order looks like to your 3PL, WMS, ERP, or OMS: component line items with real SKUs, the bundle identifier property, component attributes, line item groups, and order tags.

Flex Bundles orders reach your 3PL, WMS, ERP, or OMS as ordinary Shopify orders whose line items are the real products you pick and pack. There is no bundle SKU to map, kit, or hide, so any system that reads Shopify orders already handles them. This page lists every piece of bundle data on the order, so you can tell your integration exactly what to read.

| Question | Answer |
|----------|--------|
| What line items are on the order? | The components, one line each, with their own SKU, quantity, weight, and price |
| Is there a parent bundle line? | No, for orders placed through your storefront checkout. See [Orders expanded after checkout](#orders-expanded-after-checkout) for the exceptions |
| How do I know which lines came from a bundle? | The `_flex_bundle` line item property, or Shopify's line item group |
| How do I find bundle orders? | The `flex-bundles-has-bundle` order tag |
| How do I get revenue and units per bundle? | Sum the component lines by line item group, or use the [Analytics API](https://flexbundles.com/docs/admin-api#analytics) |
| Does inventory stay accurate? | Yes. Shopify decrements each component, never the bundle |

## What the order contains

A bundle is one line in the cart: the bundle's parent product carrying the customer's selections. At checkout, Shopify's Cart Transform expands it into the component products, so the order Shopify creates contains only the components. That is the order your fulfillment and back-office systems import.

For a bundle with a tote, two candles, and a matchbox, the order has three line items:

| SKU | Item | Qty |
|-----|------|-----|
| `TOTE-NAT` | Canvas Tote, Natural | 1 |
| `CNDL-FIG` | Fig Candle | 2 |
| `MTCH-01` | Matchbox | 1 |

Each component line carries its share of the bundle price, so line totals add up to what the customer paid for the bundle. This applies to both bundle types:

- **Fixed bundles** (pre-set contents) expand to the components you configured.
- **Flex bundles** (customer-built) expand to whatever the customer picked.

The bundle's parent product is never shipped and never decremented, so it needs no stock and no kit definition in your warehouse system.

## Line item data

Each component line can carry three kinds of data.

### The bundle identifier: `_flex_bundle`

Every component line gets a `_flex_bundle` property whose value is the bundle parent's product GID:

```json
{
  "sku": "CNDL-FIG",
  "quantity": 2,
  "properties": [
    { "name": "_flex_bundle", "value": "gid://shopify/Product/8812345678901" }
  ]
}
```

Use it to tell bundle lines from regular lines, and to group the components of one bundle on a pick list. It identifies which bundle a line belongs to, not which instance: if an order contains the same bundle twice, both sets of components share the same value. Use Shopify's line item group (below) to tell instances apart, or [add your own ID](#a-unique-id-for-each-bundle) if your tools only read properties.

Shopify hides properties that start with an underscore from shoppers, but some 3PL and shipping tools import every property and print it on packing slips. If yours does, either hide it in that tool's template or turn it off in Flex Bundles under **Settings → Order line items → Add bundle identifier to order line items**. Turning it off affects new orders only. Order tags and line item groups still work, and Flex Bundles analytics fall back to matching against your current bundles; the identifier is what keeps a line recognizable after its bundle is edited or deleted.

### Shopify's line item group

Shopify records each expanded bundle as a line item group. In the Admin GraphQL API, every component line's `lineItemGroup` field returns the group's `id`, `title`, and `quantity`, and the parent product and variant it came from. Each bundle in the cart becomes its own group, so this is the field to read when an order has several copies of the same bundle.

```graphql
{
  order(id: "gid://shopify/Order/1234567890") {
    lineItems(first: 100) {
      nodes {
        sku
        quantity
        lineItemGroup { id title quantity productId variantSku }
        customAttributes { key value }
      }
    }
  }
}
```

Other bundle apps built on Cart Transform also create line item groups. If your store runs more than one, check `_flex_bundle` or the group's `productId` to know which groups are Flex Bundles bundles.

### Your own line item properties

`_flex_bundle` is not the only property you can put on component lines. You can add your own key-value pairs to every component line item, from the storefront at add-to-cart time or from the admin ahead of time, and they reach the order as ordinary Shopify line item properties. Typical uses: a warehouse kit code, a pick or pack instruction, an ERP item class, a campaign or channel code, engraving or gift message text.

| Set from | Fixed bundles | Flex bundles |
|----------|---------------|--------------|
| **Storefront** (Cart API, per order) | `_attributes` property on the parent line: one JSON object applied to every component. See [Fixed Bundle Attributes](https://flexbundles.com/docs/cart-api-integration#fixed-bundle-attributes) | `attributes` object on each `_components` entry, set per component (repeat it on each entry to cover every line). See [Component Attributes](https://flexbundles.com/docs/cart-api-integration#component-attributes) |
| **Admin** (set once, applied to every order) | Per component in the bundle editor (**Edit component attributes**), or the `attributes` field on each component in the [Bundles Admin API](https://flexbundles.com/docs/admin-api) | **Component Attributes** in the bundle editor, or `component_attributes` in the [Bundles Admin API](https://flexbundles.com/docs/admin-api#create-a-flex-bundle): one set of key-value pairs applied to every component. See [Flex Bundle Attributes](https://flexbundles.com/docs/cart-api-integration#flex-bundle-attributes) |

For both bundle types, storefront values are merged over the attributes set in the admin and win when both use the same key. So the admin can hold permanent data (a kit code) while the storefront adds per-order data (a gift message). This add-to-cart call for a fixed bundle gives every component line both properties:

```json
{
  "id": 41234567890999,
  "quantity": 1,
  "properties": {
    "_attributes": "{\"_kit_code\":\"WKND-24\",\"Gift Message\":\"Happy birthday\"}"
  }
}
```

Keys behave like any Shopify line item property:

- **Start a key with an underscore** (like `_kit_code`) to keep it out of the shopper's view in the cart, checkout, and order emails while still sending it to your 3PL and ERP, the same way `_flex_bundle` works. Keys without an underscore are shown to the shopper.
- Values are plain strings and reach the order exactly as written. Nothing is parsed or converted, which makes them a reliable way to hand structured data to a warehouse or ERP.
- Don't use `_flex_bundle` as one of your own keys. Flex Bundles writes that one.

### A unique ID for each bundle

Some systems need to know exactly which lines were sold together as one bundle: a WMS that packs each bundle into its own box, an ERP that reconciles at the bundle level, or a returns tool that takes a bundle back as a unit. `_flex_bundle` is the same on every copy of a bundle, and the line item group is only available through the Admin GraphQL API, so a tool that reads plain line item properties cannot tell two copies apart.

The fix is to generate a UUID in your storefront each time a bundle is added to the cart and send it as an attribute. Every component of that bundle then carries the same ID on the order, and a second copy of the bundle carries a different one.

For a flex bundle, put it on each `_components` entry:

```javascript
const bundleId = crypto.randomUUID();

const components = selected.map((item) => ({
  id: item.variantId,
  quantity: item.quantity,
  attributes: { _bundle_instance_id: bundleId },
}));

await fetch('/cart/add.js', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    items: [{
      id: parentVariantId,
      quantity: 1,
      properties: { _components: JSON.stringify(components) },
    }],
  }),
});
```

For a fixed bundle, send it once in `_attributes` and it is copied to every component:

```javascript
properties: {
  _attributes: JSON.stringify({ _bundle_instance_id: crypto.randomUUID() }),
}
```

Each component line on the order then looks like this:

```json
{
  "sku": "CNDL-FIG",
  "quantity": 2,
  "properties": [
    { "name": "_flex_bundle", "value": "gid://shopify/Product/8812345678901" },
    { "name": "_bundle_instance_id", "value": "3f2b8c1e-9a4d-4e0b-b6a7-5d1c2e8f9a10" }
  ]
}
```

Things to know:

- The key name is yours to choose. Start it with an underscore so shoppers never see it.
- Generate the ID when the bundle is added, not once per page load, so adding the same bundle twice gives two IDs. Because the IDs differ, the two copies stay as separate lines in the cart instead of merging into one line with quantity 2.
- If the shopper raises the quantity of a bundle line in the cart, every copy on that line shares the ID. Have your integration treat the ID plus the quantity as the unit, or add bundles one at a time if each copy needs its own.
- Set it from the storefront, not the admin. Attributes saved in the app are the same on every order, so they cannot identify one bundle.
- Orders [expanded after checkout](#orders-expanded-after-checkout) do not carry it, like any other attribute.

## Order-level data

Every order containing a Flex Bundles bundle gets the **`flex-bundles-has-bundle`** tag, so bundle orders are filterable in admin, order search, Segments, Flow, and any tool that imports Shopify tags (for example to route bundle orders to a packing station).

There is no separate bundle-level record for an integration to read, and none is needed: the component lines already hold everything. To get revenue and units per bundle for an ERP or BI tool, group the component lines by `lineItemGroup.id` and sum their discounted totals. The group's `quantity` is the number of bundles sold. [Exporting Your Data](https://flexbundles.com/docs/exporting-data#order-level-data) has a ready-made query and bulk export instructions.

If you only need totals, not order-level detail, the [Analytics API](https://flexbundles.com/docs/admin-api#analytics) returns revenue, units, and orders per bundle per day.

Flex Bundles also saves its own summary of each order in a `$app:bundle_breakdown` metafield, which is what its analytics are built from. You can see it on the order in Shopify admin, but Shopify does not let other apps read it, so don't build an integration on it.

## Orders expanded after checkout

Some orders reach Shopify with a bundle's parent product as a single line, because the bundle was never expanded at checkout:

- **Fixed bundles** on orders created outside your storefront checkout: TikTok Shop, Amazon, the Shop app, and post-purchase offers.
- **Flex bundles** bought on a subscription, including renewal orders. The customer's selections are still on the parent line in its `_components` property.

If [Expand bundle on order edits](https://flexbundles.com/docs/bundle-types#expand-bundle-on-order-edits) is on for that bundle, Flex Bundles edits the order shortly after it is created, replacing the parent with its components.

What your systems see on those orders:

- The parent line is removed (quantity 0, restocked) and the components are added as new lines.
- A "Bundle discount" on the component lines brings their total back to exactly what the customer paid for the bundle.
- The component lines do **not** carry `_flex_bundle`, a line item group, or [your own line item properties](#your-own-line-item-properties), because Shopify's order editing cannot set them. Identify these orders by the `flex-bundles-expanded` tag; the bundle's lines are the ones carrying the "Bundle discount".
- The order is tagged `flex-bundles-expanded` when the edit succeeds, or `flex-bundles-expanded-skipped` when it could not be expanded (for example a component was out of stock or Shopify rejected the order edit). Skipped orders still hold the parent line and need manual review.
- In the rare case that the edited order's balance no longer matches what the customer paid, it is also tagged `flex-bundles-expanded-unbalanced`.

Limits: the setting is off by default and set per bundle, expansion runs only on orders paid in your shop currency, and it reads the first 100 line items of an order. For flex bundles it applies to subscription orders only.

Because the order changes after it is created, a system that imports orders immediately can pick up the parent line before the edit lands. If your 3PL imports quickly, have it hold these orders until they carry `flex-bundles-expanded`, or make sure it re-syncs line item changes from Shopify.

## Which field should your integration read?

| You need to | Read |
|-------------|------|
| Pick, pack, and ship | Order line items (the components, with SKUs and quantities) |
| Group a bundle's components on a pick list | `lineItemGroup.id`, or `_flex_bundle` if the tool only sees properties |
| Tell two copies of the same bundle apart | `lineItemGroup.id`, or [your own ID](#a-unique-id-for-each-bundle) if the tool only sees properties |
| Route or flag bundle orders | The `flex-bundles-has-bundle` tag |
| Warehouse or ERP data per item (kit codes, instructions) | [Your own line item properties](#your-own-line-item-properties) |
| Revenue and units by bundle (ERP, BI) | Component lines summed by `lineItemGroup.id`, or the [Analytics API](https://flexbundles.com/docs/admin-api#analytics) for daily totals |
| Catch orders that still need attention | `flex-bundles-expanded-skipped` and `flex-bundles-expanded-unbalanced` tags |

## Related

- [Where Bundle Data Lives](https://flexbundles.com/docs/cart-api-integration#where-bundle-data-lives): the three shapes a bundle takes from add-to-cart to fulfillment
- [Exporting Your Data](https://flexbundles.com/docs/exporting-data): CSV exports, the Analytics API, and bulk order exports
- [Bundle Types](https://flexbundles.com/docs/bundle-types): fixed, flex, and free bundles
