> ## 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/zh-Hant/templates/batch-templates-and-pick-lists.md)。
* [訂單資料匯出](https://foliant-help.iforiti.com/zh-Hant/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/zh-Hant/templates/product-options-apps.md)
* [範本中的商品項目](https://foliant-help.iforiti.com/zh-Hant/template-editor/liquid-line-items.md)
* [訂單彙總與揀貨單](https://foliant-help.iforiti.com/zh-Hant/templates/batch-templates-and-pick-lists.md)
* [開啟模板編輯器](https://foliant-help.iforiti.com/zh-Hant/template-editor/editor-overview.md)


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