> ## Documentation Index
> Fetch the complete documentation index at: https://foliant-help.iforiti.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 单据上的组合商品

> Foliant 如何将 Shopify Bundles、Simple Bundles 和 Fast Bundle 的组合商品打印为一行并列出内含商品，以及如何改为逐个列出这些商品。

当顾客购买用 **Shopify Bundles**、**Simple Bundles** 或 **Fast Bundle** 创建的组合商品时，Shopify 不会把组合商品本身记录为订单中的单独一行，而是记录其中的每件商品，并将它们与组合商品关联。Foliant 会把它们重新组合起来：您的单据显示顾客购买的组合商品，并在其下方列出内含商品。

无需安装或连接任何内容：Foliant 会自动识别组合商品，所有套餐均适用。

## 打印内容

以发票为例：

> **早餐套装** · SKU: KIT-1
> 2 × 马克杯 · MUG-01
> 4 × 咖啡豆 · BEANS-250
> 价格 $26.00 · 数量 2 · 总计 $52.00

* 组合商品打印为一行，带有自己的名称、SKU 和数量。
* 它的价格是内含商品价格之和，因此您的总计和税费不会改变。
* 在其下方，每件商品都会连同订单中的数量和 SKU 一起打印，方便拣货和包装。
* 在装箱单上，数量按完整的组合商品计算，例如 **2 / 2**。

为一批发货打印的单据，会显示组合商品以及该批发货中包含的商品。

## 改为将商品逐行列出

**代码编辑器中的内置模板：** 在模板顶部附近，将

```
{% assign SETTING_bundles = "bundle_row" %}
```

改为 `"components"`。这样每件商品都会像在 Shopify 中一样单独列为一行。

**可视化编辑器：** 选择 **商品表格** 区块，在 **行** 下取消勾选 **组合商品显示为一行，内含商品列在下方**。

**设计：** 设计始终将组合商品打印为一行，并在其下方注明内含商品名称。

## 仍按商品逐项列出的内容

为了确保数字准确，以下内容仍会单独列出组合商品中的每件商品：

* **拣货单** 和订单汇总统计的是要拣的商品，而不是组合商品。请参阅 [订单汇总和拣货单](https://foliant-help.iforiti.com/cn/templates/batch-templates-and-pick-lists.md)。
* [订单数据导出](https://foliant-help.iforiti.com/cn/exports/export-order-data.md)中每件商品占一行。
* 电子发票（ZUGFeRD、Peppol、KSeF）会列出每件商品及其各自的增值税税率。
* 发货邮件会列出该批发货中的每件商品。
* 为一次退货打印的退货单会列出每件退回的商品，因为顾客常常只退回组合商品中的一件商品。

## 在您自己的 Liquid 中

组合商品中的每个订单项目都有以下额外字段：

| 字段 | 内容 |
| - | - |
| `line_item.bundle_component` | 当该商品属于组合商品时为 `true`。 |
| `line_item.bundle_title` | 组合商品的名称。 |
| `line_item.bundle_quantity` | 一个组合商品中包含该商品的数量。 |

`bundled` 过滤器可将订单的任意订单项目列表，转换为每个组合商品各占一行的列表：

```
{% assign line_items = line_items | bundled %}
{% for line_item in line_items %}
  {{ line_item.title }} × {{ line_item.quantity }}
  {% for component in line_item.components %}
    {{ component.quantity }} × {{ component.title }}
  {% endfor %}
{% endfor %}
```

组合商品所在行的 `line_item.is_bundle` 为 `true`，带有组合商品的 `title`、`sku` 和 `quantity`，价格为内含商品价格之和，内含商品位于 `line_item.components` 中。其他行保持不变。`bundled_line_items` 是已经组合好的订单项目。

## 须知

* Foliant 识别的是在结账时组合的组合商品：Shopify Bundles、Simple Bundles 2.0 以及 Fast Bundle 的结账组合商品。在下单后才把商品添加到订单中的组合商品应用（旧版 Simple Bundles、Fast Bundle 的“single product”模式），会将组合商品及其内含商品打印为单独的行。
* 您自己编写的模板会保持原来的打印方式，直到您添加 `bundled` 过滤器。

## 相关文章

* [商品选项应用（Bold、Infinite Options）](https://foliant-help.iforiti.com/cn/templates/product-options-apps.md)
* [模板中的订单项目](https://foliant-help.iforiti.com/cn/template-editor/liquid-line-items.md)
* [订单汇总和拣货单](https://foliant-help.iforiti.com/cn/templates/batch-templates-and-pick-lists.md)
* [打开模板编辑器](https://foliant-help.iforiti.com/cn/template-editor/editor-overview.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.