Tilgå komplekse dataobjekter i Shopify Flow

Shopify Flow understøtter ikke udlæsning af matrixer og objekter. Hvis du vil kontrollere dataudlæsningen og undgå nye data, når der tilføjes API-felter, skal du i stedet gøre følgende:

  • Loop over matrixer.
  • Medtag de nødvendige felter udtrykkeligt.

Komplekse dataobjekter i det oprindelige Flow

I det oprindelige Flow, betyder kald til {{ order.lineItems }} i Liquid, at objektet udlæses i et Ruby-format. Kald med filteret | json udlæser objektet i 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.

Er du klar til at begynde at sælge med Shopify?

Prøv det gratis