Shopify Flowలో Liquid వేరియబుల్స్‌ను ఉపయోగించడం

Liquid వేరియబుల్స్ అనేవి Liquidలో నిర్వచించబడిన ప్లేస్‌హోల్డర్‌లు, ఇవి వర్క్‌ఫ్లో రన్ అయినప్పుడు GraphQL Admin APIలోని విలువలతో భర్తీ చేయబడతాయి. ఆర్డర్ నంబర్, ఆర్డర్ ధర లేదా కస్టమర్ పేరు వంటి మీ వర్క్‌ఫ్లోలలో ఉన్న కస్టమర్‌లు, ఆర్డర్‌లు మరియు ఉత్పత్తుల లక్షణాలను వేరియబుల్స్ వివరించగలవు. మీ వర్క్‌ఫ్లోలో లాజిక్‌ను నియంత్రించడానికి కండిషన్‌లలో లేదా చర్య నుండి డేటాను అవుట్‌పుట్ చేయడానికి వేరియబుల్స్‌ను ఉపయోగించవచ్చు.

Liquidను ఉపయోగించి వర్క్‌ఫ్లోలలో వేరియబుల్స్‌ను జోడించడం

మీరు వేరియబుల్‌ను జోడించండి లింక్ ఉన్న ఏవైనా టెక్స్ట్ ఫీల్డ్‌లకు Liquid ఉపయోగించి వేరియబుల్స్‌ను జోడించవచ్చు. సంబంధిత ఫీల్డ్ కింద ఉన్న వేరియబుల్‌ను జోడించండి లింక్‌ను క్లిక్ చేసి, ఆపై లిస్ట్ నుండి వేరియబుల్‌ను ఎంచుకోండి.

అంతర్గత ఇమెయిల్‌ను పంపండి చర్యకు సంబంధించిన కాన్ఫిగరేషన్ ప్యానెల్ ఇమేజ్, ఇది సబ్జెక్ట్ ఫీల్డ్ కింద ఉన్న 'వేరియబుల్‌ను జోడించండి' ఆప్షన్‌ను హైలైట్ చేస్తోంది.

వేరియబుల్‌ను జోడించండి లిస్ట్‌లోని వేరియబుల్స్ ఫిల్టర్ చేయబడతాయి, కాబట్టి మీరు ట్రిగ్గర్‌ల వలె ప్రస్తుత దశ కంటే ముందున్న దశలు అందించే వేరియబుల్స్‌ను మాత్రమే ఉపయోగిస్తారు. ఉదాహరణకు, ఆర్డర్ సృష్టించబడింది ట్రిగ్గర్ Admin API నుండి వేరియబుల్స్‌గా ఇన్సర్ట్ చేయగల ఆర్డర్ మరియు షాప్ రిసోర్స్‌లను అందిస్తుంది. మీరు లిస్ట్ నుండి ఒక వేరియబుల్‌ను ఎంచుకున్న తర్వాత, అది సరిగ్గా ఫార్మాట్ చేయబడిన Liquid వలె టెక్స్ట్ బాక్స్‌కి జోడించబడుతుంది.

మీరు నేరుగా టెక్స్ట్ ఫీల్డ్‌లో కూడా Liquidను రాయవచ్చు. ఉదాహరణకు, Shopify అడ్మిన్ నుండి order-123 వంటి ఆర్డర్ స్ట్రింగ్‌ను ప్రదర్శించడానికి మీరు {{ order.name }} వేరియబుల్‌ను ఉపయోగించవచ్చు.

Flow అనేది Liquid కోసం ఉపయోగించే డేటాను తిరిగి పొందడానికి Admin APIని ఉపయోగిస్తుంది కాబట్టి, వేరియబుల్ సింటాక్స్ క్యామెల్ కేస్ ఉపయోగిస్తుంది. క్యామెల్ కేస్ వేరియబుల్స్‌లో మొదటి పదం చిన్న అక్షరంతో మొదలవుతుంది మరియు ఆ తర్వాతి పదాలు firstName లేదా canMarkAsPaid లాగా పెద్ద అక్షరంతో మొదలవుతాయి. ఉదాహరణకు, ఉత్పత్తి సృష్టించబడిన తేదీని యాక్సెస్ చేయడానికి, {{ product.createdAt }} ఎంటర్ చేయండి. మీరు క్యామెల్ కేస్‌ను ఉపయోగించని Shopify థీమ్‌లో Liquid సింటాక్స్‌ను ఉపయోగిస్తే, అప్పుడు మీరు {{ product.created_at }} ఎంటర్ చేయాలి.

కండిషనల్, ఇటరేషన్ Liquid ట్యాగ్‌లు

కింది ఫంక్షన్‌లను చేయడానికి Liquid ట్యాగ్‌లను వేరియబుల్స్‌తో ఉపయోగించవచ్చు:

  • ఆర్డర్ మొత్తం $100 కంటే ఎక్కువగా ఉందో లేదో నిర్ధారించడం వంటి షరతులతో కూడిన స్టేట్‌మెంట్‌లను రాయవచ్చు.
  • ఆర్డర్‌లోని ప్రతి లైన్ ఐటెమ్ కోసం డేటాను అవుట్‌పుట్ చేయడం వంటి ఆబ్జెక్ట్‌ల లిస్ట్‌ను పునరావృతం చేయవచ్చు.

ఈ స్టేట్‌మెంట్‌లను రాయడానికి మరియు ఆబ్జెక్ట్‌లను పునరావృతం చేయడానికి మీరు Liquid ట్యాగ్‌లను ఉపయోగించవచ్చు.

ఉదాహరణకు, ఆర్డర్ మొత్తం $100 కంటే ఎక్కువగా ఉంటే కింది Liquid ఆర్డర్ నంబర్‌ను ప్రదర్శిస్తుంది:

{% if order.totalPriceSet.shopMoney.amount > 100 %}
  Order number: {{ order.name }}
{% endif %}

ఆర్డర్ కోసం లైన్ ఐటెమ్‌ల వంటి ఆబ్జెక్ట్‌ల లిస్ట్‌ను పునరావృతం చేయడానికి మీరు for లూప్ని కూడా ఉపయోగించవచ్చు. ఉదాహరణకు, కింది Liquid ఆర్డర్‌లోని ప్రతి లైన్ ఐటెమ్ పేరును ప్రదర్శిస్తుంది:

{% for li in order.lineItems %}
  {{ li.title }}
{% endfor %}

Flow ఈ కింది Liquid కండిషనల్ (లేదా కంట్రోల్ ఫ్లో) ట్యాగ్‌లకు సపోర్ట్ చేస్తుంది:

Flow కింది Liquid ఇటరేషన్ ట్యాగ్‌లకు కూడా సపోర్ట్ చేస్తుంది:

వేరియబుల్స్‌కు ఫిల్టర్‌లను వర్తింపజేయడం

మీరు ఫిల్టర్‌లను ఉపయోగించి Liquidలో వేరియబుల్ డేటాను మార్చవచ్చు. Flow అన్ని ఓపెన్ సోర్స్ Liquid ఫిల్టర్‌లకు సపోర్ట్ చేస్తుంది.

ఉదాహరణకు, కింది Liquid ఆర్డర్ పేరు నుండి ప్రిఫిక్స్‌ను తీసివేస్తుంది మరియు మిగిలి ఉన్న వాటిని అవుట్‌పుట్ చేస్తుంది: {{ order.name | remove: "Order-" }}

ఫిల్టర్‌లలో Liquid వేరియబుల్స్‌ను ఉపయోగించడానికి పరిగణనలు

ఫిల్టర్‌లను ఉపయోగించి వేరియబుల్స్‌ను మార్చడానికి ముందు, కింది అంశాలను సమీక్షించండి:

  • కొన్ని ఫిల్టర్‌ల కోసం అందుబాటులో ఉండే డాట్ నోటేషన్‌కు Flow సపోర్ట్ చేయదు. ఉదాహరణకు, Flow {{ order.lineItems | size }}కి సపోర్ట్ చేస్తుంది కానీ {{ order.lineItems.size }}కి సపోర్ట్ చేయదు.
  • మెటాఫీల్డ్‌ల కోసం డాట్ నోటేషన్‌కు Flow సపోర్ట్ చేయదు. ఉదాహరణకు, మీరు {{ order.metafields.custom.hold_note }}ను ఉపయోగించలేరు. దానికి బదులుగా, ఉదాహరణలలో వివరించిన విధంగా మీరు మెటాఫీల్డ్‌ల మీద లూప్ చేయాలి.
  • లిస్ట్‌లో ఐటెమ్‌లను యాక్సెస్ చేయడానికి ఇండెక్స్‌ల ఉపయోగానికి Flow సపోర్ట్ చేయదు. ఉదాహరణకు, మీరు {{ order.lineItems[0].title }}ని ఉపయోగించలేరు. దానికి బదులుగా, ఉదాహరణలలో వివరించిన విధంగా మీరు లైన్ ఐటెమ్‌ల మీద లూప్ చేయాలి.

తేదీ ఫిల్టర్‌లు

స్టాండర్డ్ Liquid ఫిల్టర్‌లతో పాటు, షెడ్యూల్ చేయబడిన సమయం ట్రిగ్గర్ మరియు డేటాను పొందండి ఫీచర్‌లకు సపోర్ట్ చేయడానికి మరొక తేదీకి సంబంధించిన తేదీని పొందేలా Flow తేదీ ఫిల్టర్‌లను అందిస్తుంది. ఆ ఫిల్టర్‌లు ఇవే: date_minus మరియు date_plus. ఉదాహరణకు:

  • భవిష్యత్తులో ఒక రోజు తేదీని తిరిగి పొందడానికి: {{ "now" | date_plus: "1 day" }}
  • గతంలో ఒక రోజు ముందు తేదీని తిరిగి పొందడానికి: {{ "now" | date_minus: "1 day" }}

ఈ ఫిల్టర్‌లు second, minute, day, week, month, మరియు yearను వ్యవధి కొలమానంగా అంగీకరిస్తాయి, సింగులర్ (second వంటివి) మరియు ప్లూరల్ (seconds వంటివి) రెండూ. కింది రకాల కస్టమైజ్ చేసుకోగల కొలమానాన్ని కూడా మీరు అందించవచ్చు:

  • సెకన్ల సంఖ్యను సూచించే పూర్ణాంకం: {{ "now" | date_minus: 3600 }}, ఇక్కడ 3600 అనేది 1 గంటకు సమానం.
  • ఒక ISO8601 డ్యూరేషన్ స్ట్రింగ్: {{ "now" | date_minus: "P1Y2D" }}, ఇక్కడ P1Y2D అంటే 1 సంవత్సరం మరియు 2 రోజులు.

క్రిప్టోగ్రాఫిక్ ఫిల్టర్‌లు

హ్యాషింగ్ మరియు హ్యాష్-ఆధారిత మెసేజ్ ప్రామాణీకరణ కోడ్‌లను (HMACలు) సృష్టించడం కోసం Flow క్రిప్టోగ్రాఫిక్ ఫిల్టర్‌లను అందిస్తుంది. విశిష్ట ఐడెంటిఫైయర్‌లు, చెక్‌సమ్‌లను సృష్టించడానికి లేదా నిర్దిష్ట హ్యాష్ ఫార్మాట్‌లు అవసరమైన థర్డ్-పార్టీ సిస్టమ్‌లతో అనుసంధానం చేయడానికి ఈ ఫిల్టర్‌లు ఉపయోగపడతాయి.

హ్యాషింగ్ ఫిల్టర్‌లు

Shopify Flow కింది రకాల హ్యాషింగ్ ఫిల్టర్‌లకు సపోర్ట్ చేస్తుంది:

  • blake3 - ఒక BLAKE3 హ్యాష్‌ని సృష్టిస్తుంది (సాధారణ వినియోగం కోసం సిఫార్సు చేయబడింది).
  • sha256 - ఒక SHA-256 హ్యాష్‌ని సృష్టిస్తుంది.
  • sha1 - ఒక SHA-1 హ్యాష్‌ని సృష్టిస్తుంది.
  • md5 - MD5 హ్యాష్‌ను సృష్టిస్తుంది.

సాధారణ హ్యాషింగ్ ప్రయోజనాలు మరియు కొత్త ఇంప్లిమెంటేషన్‌ల కోసం, మీరు blake3ని ఉపయోగించాలి, ఎందుకంటే ఇది పాత అల్గారిథమ్‌లతో పోలిస్తే మెరుగైన పనితీరును, భద్రతను అందిస్తుంది. అయితే, థర్డ్-పార్టీ సిస్టమ్‌ల అనుకూలత కోసం sha256, sha1, md5 అందుబాటులో ఉన్నాయి.

ఉదాహరణ వినియోగం: {{ "hello world" | blake3 }} అనేది "hello world"కి చెందిన BLAKE3 హ్యాష్‌ను అందిస్తుంది.

HMAC ఫిల్టర్‌లు

రహస్య కీతో HMACని సృష్టించడానికి, మద్దతు ఉన్న కింది ఫిల్టర్‌లలో ఒకదానిని ఉపయోగించండి:

ఉదాహరణ వినియోగం:

  • ప్రాథమికం: {{ "message" | hmac_sha256: "secret_key" }}
  • రహస్యాలతో (సిఫార్సు చేయబడినది): {{ "message" | hmac_sha256: secrets.api_key }}

Shopify Flowలో Liquidతో వేరియబుల్స్‌ను ఉపయోగించేందుకు ఉదాహరణలు

Liquid వేరియబుల్స్‌ను ఎలా ఉపయోగించాలో మరింత మెరుగ్గా అర్థం చేసుకోవడానికి, కింది ఉదాహరణలను పరిశీలించండి:

రిసోర్స్‌ల కోసం అవుట్‌పుట్ URLలు

మీరు వర్క్‌ఫ్లోలో ఉన్న కస్టమర్, ఆర్డర్ మరియు ఉత్పత్తి కోసం URLలను అవుట్‌పుట్ చేయాలనుకుంటున్నారు.

# Output the base Admin URL for your store
https://admin.shopify.com/store/{{ shop.myShopifyDomain | replace: ".myshopify.com", "" }}

# Assign the base Admin url to a variable named base_url:
{%- capture base_url -%}https://admin.shopify.com/store/{{ shop.myShopifyDomain | replace: ".myshopify.com", "" }}{%- endcapture -%}

# Customer from a Customer trigger:
{{ base_url }}/customers/{{ customer.legacyResourceId }}

# Customer without the base_url:
https://admin.shopify.com/store/{{ shop.myShopifyDomain | replace: ".myshopify.com", "" }}/customers/{{ customer.legacyResourceId }}

# Customer from an Order trigger:
{{ base_url }}/customers/{{ order.customer.legacyResourceId }}

# Order:
{{ base_url }}/orders/{{ order.legacyResourceId }}

# Product:
{{ base_url }}/products/{{ product.legacyResourceId }}

# Product Variant:
{{ base_url }}/products/{{ product.legacyResourceId }}/variants/{{ productVariant.legacyResourceId }}

# Example showing a clickable link in HTML, making use of the URL:
<a href="{{ base_url }}/products/{{ product.legacyResourceId }}">{{ product.title }}</a>

ట్యాగ్‌ల జాబితాను మెటాఫీల్డ్‌గా మార్చండి

మీరు ట్యాగ్‌ల సెట్‌ను, ఒక సింగిల్-లైన్ టెక్స్ట్ ఫీల్డ్‌ల జాబితా అయిన మెటాఫీల్డ్‌కి మార్చాలనుకుంటున్నారు. మీరు స్టోర్‌కు ఉత్పత్తి జోడించబడింది ట్రిగ్గర్‌ను ఉపయోగించి వర్క్‌ఫ్లోను సృష్టిస్తారు, అలాగే ఉత్పత్తి మెటాఫీల్డ్‌ను అప్‌డేట్ చేయండి చర్యను ఉపయోగిస్తారు. ఉత్పత్తి మెటాఫీల్డ్‌ను అప్‌డేట్ చేయండి చర్యలోని విలువ విభాగంలో, మీరు కింది లిక్విడ్ కోడ్‌ను జోడిస్తారు. ఈ ఉదాహరణ, ఉత్పత్తిని సృష్టించినప్పుడు మీరు ఒకసారి మాత్రమే విలువలను సెట్ చేయాలని, అలాగే ఉత్పత్తికి రెండు సంబంధిత ట్యాగ్‌లు: color:red మరియు color:orange ఉన్నాయని ఊహిస్తుంది.

సింగిల్-లైన్ టెక్స్ట్ ఫీల్డ్ జాబితాను సెట్ చేయడానికి లిక్విడ్ ఉదాహరణ.
ఇన్‌పుట్అవుట్‌పుట్
{% capture mf_value %}
{%- for tags_item in product.tags -%}
  {%- if tags_item contains "color:" -%}
    "{{- tags_item | remove_first: "color:" | strip -}}",
  {%- endif -%}
{%- endfor -%}
{% endcapture -%}
[{{mf_value | remove_last: ","}}]
      
["red","orange"]

ఆర్డర్ కోసం డైనమిక్ ఇమెయిల్ సందేశాన్ని రాయండి

ఒక కస్టమర్ ఆర్డర్‌పై $500 కంటే ఎక్కువ వెచ్చించినప్పుడు ఉద్యోగికి ఇమెయిల్ పంపేందుకు, మీరు ఒక వర్క్‌ఫ్లోను సృష్టించాలనుకుంటున్నారు. మీరు ఆర్డర్ సృష్టించబడింది ట్రిగ్గర్‌ను ఉపయోగించి వర్క్‌ఫ్లోను సృష్టిస్తారు, ఆర్డర్ మొత్తం $500 కంటే ఎక్కువ ఉంటే నిజమయ్యే షరతును సెట్ చేస్తారు, అలాగే అంతర్గత ఇమెయిల్‌ను పంపండి చర్యను ఉపయోగిస్తారు. అంతర్గత ఇమెయిల్‌ను పంపండి చర్యలోని సందేశం విభాగంలో, మీరు కింది వేరియబుల్స్‌ను ఉపయోగిస్తారు.

కస్టమర్ వివరాలను అందించడానికి ఉపయోగించే వేరియబుల్ ఉదాహరణ.
ఇన్‌పుట్అవుట్‌పుట్
Please send a personal thank you note to {{ order.customer.firstName }} {{ order.customer.lastName }}({{ order.customer.email }}) for placing an order for $ {{ order.totalPriceSet.shopMoney.amount }}.
$763.42కు ఆర్డర్ చేసినందుకు దయచేసి Jeanne Dupont (jeanne@example.com)కి వ్యక్తిగత కృతజ్ఞతా సందేశాన్ని పంపండి.

తక్కువ స్టాక్ ఉన్న ఉత్పత్తి కోసం డైనమిక్ ఇమెయిల్ సందేశాన్ని రాయండి

ఉత్పత్తి ఇన్వెంటరీ తగ్గుతున్నప్పుడు, అలాగే మరింత స్టాక్ కోసం ఆర్డర్ చేయాల్సి ఉన్నప్పుడు సిబ్బందికి తెలియజేయాలని మీరు నిర్ణయించుకున్నారు. మీరు ఇన్వెంటరీ పరిమాణం మార్చబడింది ట్రిగ్గర్‌తో ప్రారంభమయ్యే వర్క్‌ఫ్లోను సృష్టిస్తారు, దానికి ముందున్న ఇన్వెంటరీ పరిమాణం 10 కంటే తక్కువగా లేదా సమానంగా ఉంటే నిజమయ్యేలా షరతును సెట్ చేస్తారు. అంతర్గత ఇమెయిల్‌ను పంపండి చర్యలోని సందేశం విభాగంలో, మీరు కింది వేరియబుల్స్‌ను ఉపయోగిస్తారు.

ఐటెమ్ వివరాలను అందించడానికి ఉపయోగించే వేరియబుల్ ఉదాహరణ.
ఇన్‌పుట్అవుట్‌పుట్
Please reorder {{ product.title }}. Email owner@store.com to verify that they've received the purchase order.
దయచేసి High Waist Leggings - Blackను రీఆర్డర్ చేయండి. వారికి కొనుగోలు ఆర్డర్ అందిందని ధృవీకరించడానికి owner@example.comకు ఇమెయిల్ చేయండి.

మోసపూరిత ఆర్డర్ గురించి సిబ్బందికి తెలియజేయడానికి డైనమిక్ ఇమెయిల్ సందేశాన్ని రాయండి

మీరు అధిక ప్రమాద స్థాయి ఉన్న ఆర్డర్‌లను రద్దు చేయాలనుకుంటున్నారు, అయితే మీ సిబ్బంది ఆర్డర్‌ను మాన్యువల్‌గా రద్దు చేయడాన్ని ఇష్టపడతారు. మీరు ఆర్డర్ సృష్టించబడింది ట్రిగ్గర్‌తో ప్రారంభమయ్యే వర్క్‌ఫ్లోను సృష్టిస్తారు, ఆర్డర్ ప్రమాద స్థాయి ఎక్కువగా ఉంటే నిజమయ్యేలా షరతును సెట్ చేస్తారు. అంతర్గత ఇమెయిల్‌ను పంపండి చర్యలోని సందేశం విభాగంలో, మీరు కింది వేరియబుల్స్‌ను ఉపయోగిస్తారు.

మోసపూరిత ఆర్డర్‌పై సమాచారాన్ని అందించడానికి ఉపయోగించే వేరియబుల్ ఉదాహరణ.
ఇన్‌పుట్అవుట్‌పుట్
Our Shopify store has received an order with a high risk of fraud. We would like to cancel this order right away, before it is sent to production:
{{ order.name }} {{ order.billingAddress.lastName }}, {{ order.billingAddress.firstName }} {{ order.email }}
Please confirm the new order status. Thanks!
మా Shopify స్టోర్‌కు మోసం జరిగే ప్రమాదం ఎక్కువగా ఉన్న ఆర్డర్ వచ్చింది. ఈ ఆర్డర్‌ను ప్రొడక్షన్‌కి పంపేలోపు, మేము దాన్ని వెంటనే రద్దు చేయాలనుకుంటున్నాము:

#1001
Dupont, Jeanne
jeanne@example.com

దయచేసి కొత్త ఆర్డర్ స్టేటస్‌ను నిర్ధారించండి. ధన్యవాదాలు!

for లూప్‌ను ఉపయోగించి ఆర్డర్ కోసం లైన్ ఐటెమ్‌లను అవుట్‌పుట్ చేయండి

ఆర్డర్ వచ్చినప్పుడు, ఆర్డర్ చేసిన ఉత్పత్తులను కలిగి ఉన్న సందేశాన్ని పంపడం ఉపయోగకరంగా ఉంటుంది. కోడ్ బ్లాక్‌ను పదే పదే అమలు చేసే for loopను ఉపయోగించడం ద్వారా మీరు దీన్ని చేయవచ్చు. వేరియబుల్స్‌కు మద్దతు ఇచ్చే టెక్స్ట్ ఫీల్డ్‌లు, for లూప్‌లు మరియు forloop ఆబ్జెక్ట్కి కూడా మద్దతు ఇస్తాయి.

ఉదాహరణకు, మీరు ఆర్డర్‌లోని అన్ని SKUల జాబితాను, పరిమాణాలను అందించే వర్క్‌ఫ్లోను సృష్టించాలనుకుంటున్నారు. అంతర్గత ఇమెయిల్‌ను పంపండి చర్యలోని సందేశం విభాగంలో, మీరు కింది వేరియబుల్స్‌ను ఉపయోగిస్తారు.

ఆర్డర్ సమాచారాన్ని అందించడానికి ఉపయోగించే for లూప్ ఉదాహరణ.
ఇన్‌పుట్అవుట్‌పుట్
Order summary:
{% for a in order.lineItems %}
  {{a.sku}} ( {{a.quantity}} )
{% endfor %}
ఆర్డర్ సారాంశం:
8987097979 (50)
8877778887 (3)
888998898B (1)

అదనపు సమాచారంతో for లూప్‌ను ఉపయోగించి ఆర్డర్ కోసం లైన్ ఐటెమ్‌లను అవుట్‌పుట్ చేయండి

ఉత్పత్తి పేరు, SKUలు, ఒక్కో ఐటెమ్ ధర, అలాగే కస్టమర్ షిప్పింగ్ సమాచారంతో సహా ఇమెయిల్‌కి మరింత సమాచారాన్ని జోడించాలని మీరు నిర్ణయించుకున్నారు. అంతర్గత ఇమెయిల్‌ను పంపండి చర్యలోని సందేశం విభాగంలో, మీరు కింది వేరియబుల్స్‌ను ఉపయోగిస్తారు.

మరింత విస్తృతమైన ఆర్డర్ సమాచారాన్ని అందించడానికి, for లూప్ ఉపయోగం గురించి ఒక ఉదాహరణ.
ఇన్‌పుట్అవుట్‌పుట్
Order summary:
{% for a in order.lineItems %}
  Product: {{a.title}}
  SKU: {{a.sku}}
  Price (per unit): ${{a.originalUnitPriceSet.shopMoney.amount}}
  Quantity: {{a.quantity}}
{% endfor %}
ఆర్డర్ సారాంశం:
ఉత్పత్తి: High Waist Leggings - Black
SKU: 8987097979
ధర (ఒక్కో యూనిట్‌కు): $8.49
పరిమాణం: 5
ఉత్పత్తి: Athletic Socks - Blue
SKU: 888998898B
ధర (ఒక్కో యూనిట్‌కు): $5.61
పరిమాణం: 2

if స్టేట్‌మెంట్‌తో పాటు for లూప్‌ని కలపడం ద్వారా కొన్ని లైన్ ఐటెమ్‌లను అవుట్‌పుట్ చేయండి

ఒక నిర్దిష్ట వెండర్ అందించే, విక్రయించిన ఐటెమ్‌లను మీరు ట్రాక్ చేయాలి. అంతర్గత ఇమెయిల్‌ను పంపండి చర్యలోని మెసేజ్ విభాగంలో, మీరు ఈ కింది వేరియబుల్స్‌ని ఉపయోగిస్తారు, అలాగే మీ for లూప్‌లో if స్టేట్‌మెంట్‌ను చేరుస్తారు.

నిర్దిష్ట వెండర్‌ల కోసం ఆర్డర్ సమాచారాన్ని అందించడానికి, for లూప్ అలాగే if స్టేట్‌మెంట్‌ల ఉపయోగం గురించి ఉదాహరణ.
ఇన్‌పుట్అవుట్‌పుట్
Acme product sold:
{% for x in order.lineItems %}
  {% if x.vendor == 'acme-vendor' %}
    Product name: {{x.title}}
    SKU: {{x.sku}}
  {% endif %}
{% endfor %}
విక్రయించిన Acme ఉత్పత్తి:
ఉత్పత్తి పేరు: High Waist Leggings - Black
SKU: 8987097979

Shopify Flowలో కాంప్లెక్స్ డేటా ఆబ్జెక్ట్‌లు

GraphQL Admin APIలో ఉన్న దాదాపు ఎలాంటి డేటానైనా యాక్సెస్ చేయడానికి Flow మిమ్మల్ని అనుమతిస్తుంది. దీనిలో లిస్ట్‌లు, ఆబ్జెక్ట్‌ల వంటి కాంప్లెక్స్ డేటా ఆబ్జెక్ట్‌లు ఉంటాయి. అయితే, ఈ ఆబ్జెక్ట్‌లతో మీరు చేయగలిగేవాటికి కొన్ని పరిమితులు ఉన్నాయి. ఈ విభాగం ఈ పరిమితులను వివరిస్తుంది, అలాగే వాటితో ఎలా పని చేయాలో తెలిపే ఉదాహరణలను అందిస్తుంది.

లిస్ట్‌లు, ఆబ్జెక్ట్‌లను నేరుగా కాల్ చేయడానికి బదులుగా, మీరు లిస్ట్‌లో లూప్ చేసి, మీకు కావాల్సిన ఫీల్డ్‌లను మాత్రమే చేర్చాలి.

ఉదాహరణకు, {{ order.lineItems }}ని నేరుగా కాల్ చేయడానికి బదులుగా, నిర్దిష్ట ఫీల్డ్‌లను కాల్ చేయడానికి కింది ఆకృతిని ఉపయోగించండి. నేరుగా లిస్ట్ లేదా ఆబ్జెక్ట్‌ను కాల్ చేయడం ద్వారా చేర్చబడే అన్ని ఫీల్డ్‌లను ఈ ఉదాహరణలు కలిగి ఉంటాయి. మీకు అవసరమైన ఫీల్డ్‌లను కాపీ చేసి, పేస్ట్ చేయండి.

టెక్స్ట్
{% for li in order.lineItems %}
    {% comment %}li.contract - omitted{% endcomment %}

{% for ca in li.customAttributes %}
    {{ ca.key }}
    {{ ca.value }}
{% endfor %}

{% for da in li.discountAllocations %}
    {{ da.allocatedAmountSet.presentmentMoney.amount }}
    {{ da.allocatedAmountSet.presentmentMoney.currencyCode }}
    {{ da.allocatedAmountSet.shopMoney.amount }}
    {{ da.allocatedAmountSet.shopMoney.currencyCode }}
{% endfor %}

{{ li.discountedTotalSet.presentmentMoney.amount }}
{{ li.discountedTotalSet.presentmentMoney.currencyCode }}
{{ li.discountedTotalSet.shopMoney.amount }}
{{ li.discountedTotalSet.shopMoney.currencyCode }}

{{ li.discountedUnitPriceSet.presentmentMoney.amount }}
{{ li.discountedUnitPriceSet.presentmentMoney.currencyCode }}
{{ li.discountedUnitPriceSet.shopMoney.amount }}
{{ li.discountedUnitPriceSet.shopMoney.currencyCode }}

{% comment %}li.duties - omitted {% endcomment %}

{{ li.fulfillableQuantity }}

{{ li.fulfillmentService.callbackUrl }}
{{ li.fulfillmentService.fulfillmentOrdersOptIn }}
{{ li.fulfillmentService.handle }}
{{ li.fulfillmentService.id }}
{{ li.fulfillmentService.inventoryManagement }}
{% comment %}rest of location omitted{% endcomment %}
{{ li.fulfillmentService.location.name }}
{{ li.fulfillmentService.productBased }}
{{ li.fulfillmentService.serviceName }}
{% for sm in li.fulfillmentService.shippingMethods %}
    {{ sm.code }}
    {{ sm.label }}
{% endfor %}
{{ li.fulfillmentService.type }}

{{ li.fulfillmentStatus }}
{{ li.id }}

{{ li.image.altText }}
{{ li.image.height }}
{{ li.image.id }}
{% comment %}li.image.metafield omitted{% endcomment %}
{% comment %}li.image.privateMetafield omitted{% endcomment %}
{{ li.image.width }}

{{ li.merchantEditable }}
{{ li.name }}
{{ li.nonFulfillableQuantity }}

{{ li.originalTotalSet.presentmentMoney.amount }}
{{ li.originalTotalSet.presentmentMoney.currencyCode }}
{{ li.originalTotalSet.shopMoney.amount }}
{{ li.originalTotalSet.shopMoney.currencyCode }}

{{ li.originalUnitPriceSet.presentmentMoney.amount }}
{{ li.originalUnitPriceSet.presentmentMoney.currencyCode }}
{{ li.originalUnitPriceSet.shopMoney.amount }}
{{ li.originalUnitPriceSet.shopMoney.currencyCode }}

{% comment %}rest of product omitted{% endcomment %}
{{ li.product.title }}

{{ li.quantity }}
{{ li.refundableQuantity }}
{{ li.requiresShipping }}
{{ li.restockable }}

{{ li.sellingPlan.name }}

{{ li.sku }}

{% for tl in li.taxLines %}
    {{ tl.priceSet.presentmentMoney.amount | json }}
    {{ tl.priceSet.presentmentMoney.currencyCode | json }}
    {{ tl.priceSet.shopMoney.amount | json }}
    {{ tl.priceSet.shopMoney.currencyCode | json }}
    {{ tl.rate | json }}
    {{ tl.ratePercentage | json }}
    {{ tl.title | json }}
{% endfor %}

{{ li.taxable }}
{{ li.title }}

{{ li.totalDiscountSet.presentmentMoney.amount }}
{{ li.totalDiscountSet.presentmentMoney.currencyCode }}
{{ li.totalDiscountSet.shopMoney.amount }}
{{ li.totalDiscountSet.shopMoney.currencyCode }}

{{ li.unfulfilledDiscountedTotalSet.presentmentMoney.amount }}
{{ li.unfulfilledDiscountedTotalSet.presentmentMoney.currencyCode }}
{{ li.unfulfilledDiscountedTotalSet.shopMoney.amount }}
{{ li.unfulfilledDiscountedTotalSet.shopMoney.currencyCode }}

{{ li.unfulfilledOriginalTotalSet.presentmentMoney.amount }}
{{ li.unfulfilledOriginalTotalSet.presentmentMoney.currencyCode }}
{{ li.unfulfilledOriginalTotalSet.shopMoney.amount }}
{{ li.unfulfilledOriginalTotalSet.shopMoney.currencyCode }}

{{ li.unfulfilledQuantity }}

{% comment %}rest of variant omitted{% endcomment %}
{{ li.variant.title }}

{{ li.variantTitle }}
{{ li.vendor }}

{% endfor %}

json
{
    "lineItems": [
        {% for li in order.lineItems %}
            {% if forloop.first != true %},{% endif %}
        {
            "contract": {
                {% comment %}rest of contract omitted{% endcomment %}
                "id": {{ li.contract.id | json }}
            },
            "customAttributes": [
                {% for ca in li.customAttributes %}
                    {% if forloop.first != true %},{% endif %}
                    {
                        "key":{{ ca.key | json }},
                        "value":{{ ca.value | json }}
                    }
                {% endfor %}
            ],
&#x22;discountAllocations&#x22;: [
            {% for da in li.discountAllocations %}
                {% if forloop.first != true %},{% endif %}
                &#x22;allocatedAmountSet&#x22;: {
                    &#x22;presentmentMoney&#x22; : {
                        &#x22;amount&#x22;: {{ da.allocatedAmountSet.presentmentMoney.amount | json }},
                        &#x22;currencyCode&#x22;: {{ da.allocatedAmountSet.presentmentMoney.currencyCode | json }}
                    },
                    &#x22;shopMoney&#x22;: {
                        &#x22;amount&#x22;: {{ da.allocatedAmountSet.shopMoney.amount | json }},
                        &#x22;currencyCode&#x22;: {{ da.allocatedAmountSet.shopMoney.currencyCode | json }}
                    }
                }
            {% endfor %}
        ],

        &#x22;discountedTotalSet&#x22;: {
            &#x22;presentmentMoney&#x22; : {
                &#x22;amount&#x22;: {{ li.discountedTotalSet.presentmentMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.discountedTotalSet.presentmentMoney.currencyCode | json }}
            },
            &#x22;shopMoney&#x22;: {
                &#x22;amount&#x22;: {{ li.discountedTotalSet.shopMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.discountedTotalSet.shopMoney.currencyCode | json }}
            }
        },

        &#x22;discountedUnitPriceSet&#x22;: {
            &#x22;presentmentMoney&#x22; : {
                &#x22;amount&#x22;: {{ li.discountedUnitPriceSet.presentmentMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.discountedUnitPriceSet.presentmentMoney.currencyCode | json }}
            },
            &#x22;shopMoney&#x22;: {
                &#x22;amount&#x22;: {{ li.discountedUnitPriceSet.shopMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.discountedUnitPriceSet.shopMoney.currencyCode | json }}
            }
        },
        &#x22;duties&#x22;: [
            {% for duty li.duties %}
            {% if forloop.first != true %},{% endif %}
            {
                {% comment %}rest of duties omitted{% endcomment %}
                &#x22;id&#x22;: {{ duty.id | json }}
            }
            {% endfor %}
        ],
        &#x22;fulfillableQuantity&#x22;: {{ li.fulfillableQuantity | json }},

        &#x22;fulfillmentService&#x22;: {
            &#x22;callbackUrl&#x22;:{{ li.fulfillmentService.callbackUrl | json }},
            &#x22;fulfillmentOrdersOptIn&#x22;: {{ li.fulfillmentService.fulfillmentOrdersOptIn | json }},
            &#x22;handle&#x22;: {{ li.fulfillmentService.handle | json }},
            &#x22;id&#x22;: {{ li.fulfillmentService.id | json }},
            &#x22;inventoryManagement&#x22;: {{ li.fulfillmentService.inventoryManagement | json }},
            {% comment %}fulfillmentService.inventoryManagement - omitted {% endcomment %}
            &#x22;productBased&#x22;: {{ li.fulfillmentService.productBased | json }},
            &#x22;serviceName&#x22;: {{ li.fulfillmentService.serviceName | json }},
            &#x22;shippingMethods&#x22;: [
                {% for sm in li.fulfillmentService.shippingMethods %}
                    {% if forloop.first != true %},{% endif %}
                    {
                        &#x22;code&#x22;: {{ sm.code | json }},
                        &#x22;label&#x22;: {{ sm.label | json }}
                    }
                {% endfor %}
            ],
            &#x22;type&#x22;: {{ li.fulfillmentService.type | json }}

        },
        &#x22;fulfillmentStatus&#x22;: {{ li.fulfillmentStatus | json }},
        &#x22;id&#x22;: {{ li.id | json }},
        &#x22;image&#x22;: {
            &#x22;altText&#x22;: {{ li.image.altText | json }},
            &#x22;height&#x22;: {{ li.image.height | json }},
            &#x22;id&#x22;: {{ li.image.id | json }},
            {% comment %}li.image.metafield omitted{% endcomment %}
            {% comment %}li.image.privateMetafield omitted{% endcomment %}
            &#x22;width&#x22;:{{ li.image.width | json }}
        },
        &#x22;merchantEditable&#x22;: {{ li.merchantEditable | json }},
        &#x22;name&#x22;: {{ li.name | json }},
        &#x22;nonFulfillableQuantity&#x22;: {{ li.nonFulfillableQuantity | json }},

        &#x22;originalTotalSet&#x22;: {
            &#x22;presentmentMoney&#x22; : {
                &#x22;amount&#x22;: {{ li.originalTotalSet.presentmentMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.originalTotalSet.presentmentMoney.currencyCode | json }}
            },
            &#x22;shopMoney&#x22;: {
                &#x22;amount&#x22;: {{ li.originalTotalSet.shopMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.originalTotalSet.shopMoney.currencyCode | json }}
            }
        },

        &#x22;originalUnitPriceSet&#x22;: {
            &#x22;presentmentMoney&#x22; : {
                &#x22;amount&#x22;: {{ li.originalUnitPriceSet.presentmentMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.originalUnitPriceSet.presentmentMoney.currencyCode | json }}
            },
            &#x22;shopMoney&#x22;: {
                &#x22;amount&#x22;: {{ li.originalUnitPriceSet.shopMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.originalUnitPriceSet.shopMoney.currencyCode | json }}
            }
        },

        &#x22;product&#x22;: {
            {% comment %}rest of Product omitted{% endcomment %}
            &#x22;title&#x22;: {{ li.product.title | json }}
        },

        &#x22;quantity&#x22;: {{ li.quantity | json }},
        &#x22;refundableQuantity&#x22;: {{ li.refundableQuantity | json }},
        &#x22;requiresShipping&#x22;: {{ li.requiresShipping | json }},
        &#x22;restockable&#x22;: {{ li.restockable | json }},

        &#x22;sellingPlan&#x22;: {
            &#x22;name&#x22;: {{ li.sellingPlan.name | json }}
        },

        &#x22;sku&#x22;: {{ li.sku | json }},

        &#x22;taxLines&#x22;: [
            {% for tl in li.taxLines %}
                {% if forloop.first != true %},{% endif %}
                {
                    &#x22;priceSet&#x22;: {
                        &#x22;presentmentMoney&#x22; : {
                            &#x22;amount&#x22;: {{ tl.priceSet.presentmentMoney.amount | json }},
                            &#x22;currencyCode&#x22;: {{ tl.priceSet.presentmentMoney.currencyCode | json }}
                        },
                        &#x22;shopMoney&#x22;: {
                            &#x22;amount&#x22;: {{ tl.priceSet.shopMoney.amount | json }},
                            &#x22;currencyCode&#x22;: {{ tl.priceSet.shopMoney.currencyCode | json }}
                        }
                    },
                    &#x22;rate&#x22;: {{ tl.rate | json }},
                    &#x22;ratePercentage&#x22;: {{ tl.ratePercentage | json }},
                    &#x22;title&#x22;: {{ tl.title | json }}
                }
            {% endfor %}
        ],
        &#x22;taxable&#x22;:{{ li.taxable | json }},
        &#x22;title&#x22;:{{ li.title | json }},

        &#x22;totalDiscountSet&#x22;: {
            &#x22;presentmentMoney&#x22; : {
                &#x22;amount&#x22;: {{ li.totalDiscountSet.presentmentMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.totalDiscountSet.presentmentMoney.currencyCode | json }}
            },
            &#x22;shopMoney&#x22;: {
                &#x22;amount&#x22;: {{ li.totalDiscountSet.shopMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.totalDiscountSet.shopMoney.currencyCode | json }}
            }
        },

        &#x22;unfulfilledDiscountedTotalSet&#x22;: {
            &#x22;presentmentMoney&#x22; : {
                &#x22;amount&#x22;: {{ li.unfulfilledDiscountedTotalSet.presentmentMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.unfulfilledDiscountedTotalSet.presentmentMoney.currencyCode | json }}
            },
            &#x22;shopMoney&#x22;: {
                &#x22;amount&#x22;: {{ li.unfulfilledDiscountedTotalSet.shopMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.unfulfilledDiscountedTotalSet.shopMoney.currencyCode | json }}
            }
        },

        &#x22;unfulfilledOriginalTotalSet&#x22;: {
            &#x22;presentmentMoney&#x22; : {
                &#x22;amount&#x22;: {{ li.unfulfilledOriginalTotalSet.presentmentMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.unfulfilledOriginalTotalSet.presentmentMoney.currencyCode | json }}
            },
            &#x22;shopMoney&#x22;: {
                &#x22;amount&#x22;: {{ li.unfulfilledOriginalTotalSet.shopMoney.amount | json }},
                &#x22;currencyCode&#x22;: {{ li.unfulfilledOriginalTotalSet.shopMoney.currencyCode | json }}
            }
        },

        &#x22;unfulfilledQuantity&#x22;: {{ li.unfulfilledQuantity | json }},

        &#x22;variant&#x22;: {
            {% comment %}rest of variant omitted {% endcomment %}
            &#x22;title&#x22;: {{ li.variant.title | json }}
        },

        &#x22;variantTitle&#x22;: {{ li.variantTitle | json }},
        &#x22;vendor&#x22;: {{ li.vendor | json }}
    }
{% endfor %}
]

}