הפניה למשתנים ומסננים של Liquid עבור Shopify Order Printer
אפשר להשתמש ב-Liquid כדי לבנות תבניות מותאמות אישית באפליקציה Shopify Order Printer. בעזרת Liquid, אפשר ליצור תבניות טקסט ולהציג אותן על סמך הנתונים הייחודיים של כל הזמנה.
הפניות ה-Liquid המפורטות בדף זה הן הרחבה של גרסת הקוד הפתוח של Liquid ומיועדות לשימוש באפליקציה Shopify Order Printer. כדי להציג מידע על סמך המאפיינים order ו-shop, אפשר להשתמש ברשימת האובייקטים, התגים והמסננים שבהפניה זו כדי להתאים אישית את התבניות. בנוסף, אפשר להיעזר במסמכי העזרה של GraphQL Admin API כדי לקבל פרטים על שדות של אובייקטים.
בדף זה
שימוש במשתנים ומאפיינים
בתבניות של Shopify Order Printer, אובייקטי הנתונים המרכזיים הם order ו-shop. כדי לגשת למאפייני ההזמנה, אפשר להשתמש ב-order.variable_name.
הגישה למאפייני ההזמנה הנפוצים הבאים אפשרית ללא הקידומת order.:
line_itemstax_linesfulfillmentstransactionsdiscountsrefundsshipping_methodscustomer
לדוגמה, אם רוצים לגשת למשתנה 'פריטי שורה', אפשר להשתמש ב-line_items או ב-order.line_items.
משתני Liquid הזמינים ב-Shopify Order Printer
המחלקות הבאות זמינות. המאפיינים מפורטים בסדר אלפביתי.
הזמנה
מאפייני ההזמנה הבאים זמינים ב-Shopify Order Printer:
attributesb2bbilling_addresscancel_reasoncancel_reason_labelcancelledcancelled_atcart_level_discount_applicationscheckout_idcheckout_payment_collection_urlcompanycompany_locationconfirmation_numbercreated_at. השעה שבה ההזמנה עובדה. ערך זה זהה ל-order.processed_atמתוך ה-GraphQL API. יש להשתמש במסנןdateכדי לעצב את חותמת הזמן, לדוגמה באמצעות{{ order.created_at | date: "%B %e, %Y" }}.customerdiscounts. הוצא משימוש מכיוון שלא כל סוגי ההנחות והפרטים נקלטים. המאפייןorder.discountsהוחלף ב-order.discount_applications.discounts_amount. הוצא משימוש מכיוון שלא כל סוגי ההנחות והפרטים נקלטים. המאפייןorder.discountsהוחלף ב-order.total_discounts.discount_applicationsdiscounts_savings. הוצא משימוש מכיוון שלא כל סוגי ההנחות והפרטים נקלטים. המאפייןorder.discountsהוחלף ב--.emailfeesfinancial_statusfinancial_status_labelfulfilled_line_itemsfulfillment_abortedfulfillment_statusfulfillmentsgatewayiditem_countlanding_sitelanding_site_refline_itemsline_items_subtotal_pricelocationmetafieldsnamenet_paymentnoteorder_nameorder_numberorder_status_urlpaymentpayment_detailspo_numberrefundsrequires_shippingshipping_addressshipping_methodshipping_methodsshipping_priceshopshop_namesubtotal_pricetagstax_linestax_pricetip_line_itemstotal_discountstotal_dutiestotal_landed_cost_additional_feestotal_net_amounttotal_outstandingtotal_pricetotal_refunded_amounttotal_tiptransactionsunacceptable_risksunfulfilled_line_itemsunique_gatewaysuservoid_transactions
חנות
להלן רשימת מאפייני החנות הזמינים ב-Shopify Order Printer:
accepts_gift_cardsaccount_ownerallows_discountscheckoutcheckout_requires_confirmation_stepcollections_countcontact_informationcurrencycustomer_accounts_enabledcustomer_accounts_optionaldescriptiondomainemailemail_accent_coloremail_logo_urlemail_logo_widthemail_marketingenabled_currenciesenabled_localesenabled_payment_typesfeaturesidlatitudelegal_noticelongitudemetafieldsmoney_formatmoney_with_currency_formatnamepassword_messagepermanent_domainphonepoliciesprivacy_policyproducts_countrefund_policysecure_urlshipping_policysubscription_policyterms_of_saleterms_of_servicetypesurl
LineItem
יש לעיין ברשימה הבאה של מאפייני פריט שורה הזמינים ב-Shopify Order Printer:
aggregated_updateapplied_discounts. הוצא משימוש מכיוון שלא כל סוגי ההנחות והפרטים זמינים. המאפייןline_item.discountsהוחלף ב-line_item.discount_allocations.current_quantitydiscount_allocationsdiscounts. הוצא משימוש מכיוון שלא כל סוגי ההנחות והפרטים זמינים. המאפייןline_item.discountsהוחלף ב-line_item.discount_allocations.final_line_pricefinal_pricefulfillmentfulfillment_servicegift_cardgramsgroupsidimageindexitem_updatesjson_filterkeyline_level_discount_allocationsline_level_total_discountline_price. הוצא משימוש מכיוון שהנחות הנובעות מהנחות אוטומטיות ומקודי הנחה אינן כלולות. המאפייןline_item.line_priceהוחלף ב-line_item.final_line_price.messageoptions_with_valuesoriginal_line_priceoriginal_priceprice. הוצא משימוש מכיוון שהנחות הנובעות מהנחות אוטומטיות ומקודי הנחה אינן כלולות. המאפייןline_item.priceהוחלף ב-line_item.final_price.productproduct_idpropertiesquantityrefunded_quantityrequires_shippingselling_plan_allocationskusuccessfully_fulfilled_quantitytax_linestaxabletitletotal_discount. הוצא משימוש מכיוון שהנחות הנובעות מהנחות אוטומטיות ומקודי הנחה אינן כלולות. המאפייןline_item.total_discountהוחלף ב-line_item.line_level_total_discount.unit_priceunit_price_measurementurlurl_to_removevariantvariant_idvendor
מילוי הזמנה
יש לעיין ברשימה הבאה של מאפייני מילוי הזמנה הזמינים ב-Shopify Order Printer:
created_at. יש להשתמש במסנןdateכדי לעצב את חותמת הזמן, לדוגמה באמצעות{{ fulfillment.created_at | date: "%B %e, %Y" }}.estimated_delivery_atfulfillment_line_itemsitem_countline_itemsrequires_shippingtracking_companytracking_numbertracking_numberstracking_urltracking_urlsupdated_at
כתובת
יש לעיין ברשימה הבאה של מאפייני הכתובת (Address) שזמינים ב-Shopify Order Printer:
address1address2citycompanycountrycountry_codecountry_uppererrorsfirst_nameidlast_namenamephoneprovinceprovince_codestreetsummarytranslated_country_nametranslated_province_nameurlzip
לקוח
יש לעיין ברשימה הבאה של מאפייני הלקוח (Customer) שזמינים ב-Shopify Order Printer:
accepts_marketingaccount_activation_urladdressesaddresses_countb2b?default_addressemailfirst_namehas_accountidlast_namelast_ordermetafieldsnamenew_addressordersorders_countpayment_methodsphonereset_password_urlsubscribe_urltagstax_exempttotal_spent
DiscountApplication
יש לעיין ברשימה הבאה של מאפייני ה-DiscountApplication שזמינים ב-Shopify Order Printer:
target_selectiontarget_typetitletotal_allocated_amounttypevalue_typevalue
הדפסת הנחות
ניתן להחיל הנחות על ההזמנה כולה או על פריטי שורה ספציפיים:
- הנחות ברמת ההזמנה: חלות על כל ההזמנה. ניתן להציג הנחות אלו בנפרד בתחתית בעת הדפסת חשבונית ההזמנה.
- הנחות ברמת פריט השורה: חלות על פריטים בודדים. ניתן לציין הנחות אלו בעת הדפסת פרטי פריט בודד במקטע פריט השורה.
ניתן לגשת למידע על ההנחות באמצעות המשתנים הבאים:
- כדי לגשת לכל ההנחות שהוחלו על ההזמנה או על כל אחד מפריטי השורה שלה, יש להשתמש בערך
order.total_discountsובאוסףorder.discount_applications. - כדי לגשת להנחות פריט שורה, יש להשתמש בערך
line_item.line_level_total_discountאו באוסףline_item.line_level_discount_allocations. - כדי לגשת למחיר של פריט השורה לפני שהוחלו עליו הנחות כלשהן, יש להשתמש בערך
line_item.original_price. - כדי לגשת למחיר הסופי של פריט השורה לאחר החלת כל ההנחות הקשורות ברמת פריט השורה, יש להשתמש בערך
line_item.final_price. - הערכים
line_item.original_line_priceו-line_item.final_line_priceשווים לערכיםline_item.original_priceו-line_item.final_priceכשהם מוכפלים ב-line_item.quantity. - כדי לגשת להנחות ברמת ההזמנה, יש להשתמש באוסף
order.cart_level_discount_applications.
בלוק קוד לדוגמה להדפסת הנחות ברמת פריט השורה:
{% for line_item in order.line_items %}
<tr>
<td>{{ line_item.quantity }}</td>
<td>{{ line_item.title }}
{% if line_item.line_level_discount_allocations.size > 0 %}
<span class="subduedText">
{% for discount_allocation in line_item.line_level_discount_allocations %}
<br>{{ discount_allocation.discount_application.title }} (-{{ discount_allocation.amount | money }})
{% endfor %}
</span>
{% endif %}
</td>
<td style="text-align: right;">
{% if line_item.original_price != line_item.final_price %}
<span class="subduedText"><s>{{ line_item.original_price | money }}</s></span>
{% endif %}
{{ line_item.final_price | money }}
</td>
</tr>
{% endfor %}בלוק קוד לדוגמה להדפסת הנחות ברמת ההזמנה:
{% for discount_application in order.cart_level_discount_applications %}
<tr>
<td colspan="2" style="text-align: right;">{% if discount_application.title %}<span class="subduedText">{{ discount_application.title }}</span>{% endif %}</td>
<td style="text-align: right;">-{{ discount_application.total_allocated_amount | money }}</td>
</tr>
{% endfor %}- למידע נוסף על סוגי הנחות ועל עבודה עם הנחות ב-Liquid.
DiscountAllocation
יש לעיין ברשימה הבאה של מאפייני ה-DiscountAllocation שזמינים ב-Shopify Order Printer:
amountdiscount_application
הנחה
יש לעיין ברשימה הבאה של מאפייני ההנחה (Discount) שזמינים ב-Shopify Order Printer:
amountcodefree_shipping_discountidsavingstitletotal_amounttotal_savings
מוצר
יש לעיין ברשימה הבאה של מאפייני המוצר שזמינים ב-Shopify Order Printer:
as_jsonavailablecollectionscompare_at_pricecompare_at_price_maxcompare_at_price_mincompare_at_price_variescontentcreated_atdescriptionfeatured_imagefeatured_mediafirst_available_variantgift_card?handlehas_only_default_variantidimagesjson_filtermediametafieldsobject_typeoptionsoptions_by_nameoptions_with_valuespriceprice_maxprice_minprice_variespublished_atrequires_selling_planselected_or_first_available_selling_plan_allocationselected_or_first_available_variantselected_selling_planselected_selling_plan_allocationselected_variantselling_plan_groupstagstemplate_suffixtitletypeurlvariantsvendor
גרסה
יש לעיין ברשימה הבאה של מאפייני הגרסה שזמינים ב-Shopify Order Printer:
as_jsonavailablebarcodecompare_at_pricefeatured_imagefeatured_mediaidimageincominginventory_managementinventory_policyinventory_quantityjson_filtermetafieldsnext_incoming_dateoption1option2option3optionspriceproductrequires_selling_planrequires_shippingselected_selling_plan_allocationselling_plan_allocationsskustore_availabilitiestaxabletitleunit_priceunit_price_measurementurlweightweight_in_unitweight_unit
החזר כספי
יש לעיין ברשימה הבאה של מאפייני ההחזרים הכספיים שזמינים ב-Shopify Order Printer:
amountcreated_atidnoterefund_line_itemsrestocktransactions
ShippingLine
יש לעיין ברשימה הבאה של מאפייני שורות השילוח שזמינים ב-Shopify Order Printer:
handleidoriginal_priceprice. יצא משימוש משום שהמחיר לא כלל הנחות ברמת ההזמנה. המאפייןshipping_line.priceהוחלף במאפייןshipping_line.price_with_discounts.price_with_discountstax_linestitle
TaxLine
יש לעיין ברשימה הבאה של מאפייני שורות המס שזמינים ב-Shopify Order Printer:
priceraterate_percentagetitle
עסקה
יש לעיין ברשימה הבאה של מאפייני העסקאות שזמינים ב-Shopify Order Printer:
amountbuyer_pending_payment_instructionsbuyer_pending_payment_noticecreated_atgatewaygateway_display_nameidkindnamepayment_detailsreceiptshow_buyer_pending_payment_instructionsstatusstatus_label
מטא שדה
מטא שדה המצורף לאובייקט אב. כדי ללמוד כיצד לגשת למטא שדה באובייקט ספציפי, יש לעיין בסעיף גישה למטא שדות.
מטא שדות תומכים בסוגי נתונים מרובים, אשר קובעים את סוג המידע המאוחסן במטא שדה. כדי לגשת למטא שדות, נתיב הגישה מורכב משתי שכבות:
- מרחב שמות (namespace) - קבוצה של מטא שדות כדי למנוע התנגשויות,
- מפתח (key) - שם המטא שדה.
לאור זאת, אפשר לגשת לאובייקט המטא שדה באמצעות התחביר הבא: {{ resource.metafields.namespace.key }}.
מתן שמות: <object>.metafields.<namespace>.<key>. לדוגמה, order.metafields.shipping.express_delivery_status.
סוגים:
StringArray- יש להשתמש ב-[ ]לאינדקס. לדוגמה,order.metafield.shipping.express_delivery_status[0]IntegerBooleanDate
הערה: סוג Metaobject אינו נתמך.
אובייקטים שתומכים במטא שדות:
OrderCustomerProductVariantLocation
מסנני Liquid הזמינים ב-Shopify Order Printer
אופן השימוש
כדי להחיל מסננים על פלט, יש להוסיף את המסנן ופרמטרים כלשהם של המסנן בתוך התוחמים של סוגריים מסולסלים {{ }} של הפלט, ולפניהם תו קו ניצב |. בדוגמה הבאה, product (מוצר) הוא האובייקט, title (כותרת) הוא המאפיין שלו, ו-upcase (הפיכה לאותיות רישיות) הוא המסנן המוחל:
{{ product.title | upcase }}אם ל-product.title יש את הערך Health potion, אז HEALTH POTION יהיה הפלט של המסנן upcase.
לפרטים על אופן השימוש במסנני Liquid, יש לעיין בסעיף המסננים בהפניה של Liquid לערכות נושא של Shopify.
מסננים להחלה על אובייקטי כתובת (Address)
format_address
לדוגמאות לשימוש, עיינו בתיעוד של Liquid לערכות הנושא של Shopify בנושא format_address.
מסננים להחלה על כל טקסט / מחרוזת
camelcasecamelizeencode_url_componentformat_codehandlehighlightpad_spacesparagraphizepluralizeurl_escapeurl_param_escape
לדוגמאות לשימוש, עיינו בתיעוד של Liquid לערכות הנושא של Shopify בנושא מסנני מחרוזות.
מסננים להחלה על מספרים המייצגים כסף
moneymoney_with_currencymoney_without_currencymoney_without_trailing_zeros
Shopify Order Printer משתמש באפשרויות עיצוב המטבע של התראות אימייל המוגדרות במנהל של Shopify כדי לעצב כסף.
ניתן לשנות את עיצוב המטבע. הגדירו את הערכים Email with currency ו-Email without currency במנהל של Shopify כדי לשנות את עיצוב מסנני הכסף ב-Shopify Order Printer.
לדוגמאות לשימוש, עיינו בתיעוד של Liquid לערכות הנושא של Shopify בנושא מסנני כסף.
מסננים להחלה כדי להמיר אובייקטים ל-json
json
לדוגמאות לשימוש, עיינו בתיעוד של Liquid לערכות הנושא של Shopify בנושא מסנני json.
מסננים להחלה על מספרים המייצגים משקל
weightweight_with_unit
לדוגמאות לשימוש, עיינו בתיעוד של Liquid לערכות הנושא של Shopify בנושא משקל עם יחידת מידה.
מסננים להחלה על תגים
highlight_active_taglink_to_add_taglink_to_remove_taglink_to_tag
לדוגמאות לשימוש, עיינו בתיעוד של Liquid לערכות הנושא של Shopify בנושא מסנני תגים.
מסננים להחלה על כתובות URL
article_img_urlasset_img_urlasset_urlcdn_asset_urlcollection_img_urlfile_img_urlfile_urlglobal_asset_urlimage_urlimg_tagimg_urllink_topayment_icon_png_urlpayment_type_img_urlpayment_type_svg_tagplaceholder_svg_tagproduct_img_urlscript_tagshopify_asset_urlstylesheet_tag
לדוגמאות שימוש במסנני המדיה הנתמכים, יש לעיין בתיעוד של Liquid לערכות נושא של Shopify בנושא מסנני מדיה.
מסננים שיש להחיל על אוספים
link_to_typelink_to_vendorsort_byurl_for_typeurl_for_vendorwithin
לדוגמאות לשימוש, עיינו בתיעוד של Liquid לערכות הנושא של Shopify בנושא מסנני קולקציות.