You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何创建两个不同Line Item Group并整合,及在行项目中嵌套Line Item Group?

关于Zapier中Line Item Group的创建、整合与嵌套问题

一、创建并整合两个不同的Line Item Group

在Zapier的Code模式中,可先分别定义两个独立的Line Item Group数组,再将它们合并到一个统一数组中完成整合。示例代码如下:

// 定义第一个Line Item Group
const group1 = [
  {
    item_number: 1,
    item_name: 'Product A',
    quantity: 2,
    unit_of_measure: 'pieces',
    unit_price: 50,
    net_price: 100,
    tax_breakdown: [{regime: 'VAT', rate: 27, amount: 27}]
  }
];

// 定义第二个Line Item Group
const group2 = [
  {
    item_number: 2,
    item_name: 'Delivery1',
    quantity: 1,
    unit_of_measure: 'pieces',
    unit_price: 100,
    net_price: 100,
    tax_breakdown: [{regime: 'VAT', rate: 27, amount: 27}]
  }
];

// 整合两个分组
const combinedItems = [...group1, ...group2];

二、在行项目中嵌套Line Item Group

要实现Line Item内嵌套Line Item Group,只需在单个Line Item对象中添加子级数组字段(例如命名为line_item_group),将子分组的行项目放入其中即可。示例代码如下:

const nestedItems = [
  {
    item_number: 1,
    item_name: 'Main Package',
    quantity: 1,
    unit_price: 200,
    net_price: 200,
    // 嵌套的Line Item Group
    line_item_group: [
      {
        item_number: 1.1,
        item_name: 'Accessory 1',
        quantity: 1,
        unit_price: 50,
        net_price: 50,
        tax_breakdown: [{regime: 'VAT', rate: 27, amount: 13.5}]
      },
      {
        item_number: 1.2,
        item_name: 'Accessory 2',
        quantity: 2,
        unit_price: 30,
        net_price: 60,
        tax_breakdown: [{regime: 'VAT', rate: 27, amount: 16.2}]
      }
    ],
    tax_breakdown: [{regime: 'VAT', rate: 27, amount: 54}]
  }
];

非代码方式:通过Input Designer添加Line Item Group

在Zapier开发者平台的Input Designer中,支持可视化添加Line Item Group,无需编写代码即可创建分组结构。

![Zapier开发者平台代码模式](Code Mode in Developer Zapier)

内容的提问来源于stack exchange,提问作者Joshua Lim

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 21:06:17