存取 Shopify Flow 中的複雜資料物件

Shopify Flow 不支援輸出陣列和物件。若要控制資料輸出,並避免新增 API 欄位時產生新資料,請改為執行下列操作:

  • 迴圈執行陣列。
  • 請明確包含必要欄位。

原始 Flow 中的複雜資料物件

在原始 Flow 中,呼叫 Liquid 中的 {{ order.lineItems }} 會以 Ruby 格式輸出物件。使用 | json 篩選條件呼叫會以 json 格式輸出物件。

Complex data objects in Shopify Flow

Avoid calling arrays and objects directly in Shopify Flow for the following reasons:

  • Outputting data that isn't required is deprecated for GraphQL API, and it might create large query sizes that cause your workflow to fail.
  • When new features are introduced, new API fields are added, which might break your workflow.

If too much data is sent automatically, the workflow fails. Instead of calling arrays and objects directly, loop over arrays and include only the fields that you want.

For example, instead of calling {{ order.lineItems }} directly, use the following format to call specific fields. These examples include all the fields that would be included by calling the array or object directly. Copy and paste the fields that you need.

準備好開始透過 Shopify 銷售商品了嗎?

免費試用