הפניה למשתנים ומסננים של 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_items
  • tax_lines
  • fulfillments
  • transactions
  • discounts
  • refunds
  • shipping_methods
  • customer

לדוגמה, אם רוצים לגשת למשתנה 'פריטי שורה', אפשר להשתמש ב-line_items או ב-order.line_items.

משתני Liquid הזמינים ב-Shopify Order Printer

המחלקות הבאות זמינות. המאפיינים מפורטים בסדר אלפביתי.

הזמנה

מאפייני ההזמנה הבאים זמינים ב-Shopify Order Printer:

  • attributes
  • b2b
  • billing_address
  • cancel_reason
  • cancel_reason_label
  • cancelled
  • cancelled_at
  • cart_level_discount_applications
  • checkout_id
  • checkout_payment_collection_url
  • company
  • company_location
  • confirmation_number
  • created_at. השעה שבה ההזמנה עובדה. ערך זה זהה ל-order.processed_at מתוך ה-GraphQL API. יש להשתמש במסנן date כדי לעצב את חותמת הזמן, לדוגמה באמצעות {{ order.created_at | date: "%B %e, %Y" }}.
  • customer
  • discounts. הוצא משימוש מכיוון שלא כל סוגי ההנחות והפרטים נקלטים. המאפיין order.discounts הוחלף ב-order.discount_applications.
  • discounts_amount. הוצא משימוש מכיוון שלא כל סוגי ההנחות והפרטים נקלטים. המאפיין order.discounts הוחלף ב-order.total_discounts.
  • discount_applications
  • discounts_savings. הוצא משימוש מכיוון שלא כל סוגי ההנחות והפרטים נקלטים. המאפיין order.discounts הוחלף ב--.
  • email
  • fees
  • financial_status
  • financial_status_label
  • fulfilled_line_items
  • fulfillment_aborted
  • fulfillment_status
  • fulfillments
  • gateway
  • id
  • item_count
  • landing_site
  • landing_site_ref
  • line_items
  • line_items_subtotal_price
  • location
  • metafields
  • name
  • net_payment
  • note
  • order_name
  • order_number
  • order_status_url
  • payment
  • payment_details
  • po_number
  • refunds
  • requires_shipping
  • shipping_address
  • shipping_method
  • shipping_methods
  • shipping_price
  • shop
  • shop_name
  • subtotal_price
  • tags
  • tax_lines
  • tax_price
  • tip_line_items
  • total_discounts
  • total_duties
  • total_landed_cost_additional_fees
  • total_net_amount
  • total_outstanding
  • total_price
  • total_refunded_amount
  • total_tip
  • transactions
  • unacceptable_risks
  • unfulfilled_line_items
  • unique_gateways
  • user
  • void_transactions

חנות

להלן רשימת מאפייני החנות הזמינים ב-Shopify Order Printer:

  • accepts_gift_cards
  • account_owner
  • allows_discounts
  • checkout
  • checkout_requires_confirmation_step
  • collections_count
  • contact_information
  • currency
  • customer_accounts_enabled
  • customer_accounts_optional
  • description
  • domain
  • email
  • email_accent_color
  • email_logo_url
  • email_logo_width
  • email_marketing
  • enabled_currencies
  • enabled_locales
  • enabled_payment_types
  • features
  • id
  • latitude
  • legal_notice
  • longitude
  • metafields
  • money_format
  • money_with_currency_format
  • name
  • password_message
  • permanent_domain
  • phone
  • policies
  • privacy_policy
  • products_count
  • refund_policy
  • secure_url
  • shipping_policy
  • subscription_policy
  • terms_of_sale
  • terms_of_service
  • types
  • url

LineItem

יש לעיין ברשימה הבאה של מאפייני פריט שורה הזמינים ב-Shopify Order Printer:

  • aggregated_update
  • applied_discounts. הוצא משימוש מכיוון שלא כל סוגי ההנחות והפרטים זמינים. המאפיין line_item.discounts הוחלף ב-line_item.discount_allocations.
  • current_quantity
  • discount_allocations
  • discounts. הוצא משימוש מכיוון שלא כל סוגי ההנחות והפרטים זמינים. המאפיין line_item.discounts הוחלף ב-line_item.discount_allocations.
  • final_line_price
  • final_price
  • fulfillment
  • fulfillment_service
  • gift_card
  • grams
  • groups
  • id
  • image
  • index
  • item_updates
  • json_filter
  • key
  • line_level_discount_allocations
  • line_level_total_discount
  • line_price. הוצא משימוש מכיוון שהנחות הנובעות מהנחות אוטומטיות ומקודי הנחה אינן כלולות. המאפיין line_item.line_price הוחלף ב-line_item.final_line_price.
  • message
  • options_with_values
  • original_line_price
  • original_price
  • price. הוצא משימוש מכיוון שהנחות הנובעות מהנחות אוטומטיות ומקודי הנחה אינן כלולות. המאפיין line_item.price הוחלף ב-line_item.final_price.
  • product
  • product_id
  • properties
  • quantity
  • refunded_quantity
  • requires_shipping
  • selling_plan_allocation
  • sku
  • successfully_fulfilled_quantity
  • tax_lines
  • taxable
  • title
  • total_discount. הוצא משימוש מכיוון שהנחות הנובעות מהנחות אוטומטיות ומקודי הנחה אינן כלולות. המאפיין line_item.total_discount הוחלף ב-line_item.line_level_total_discount.
  • unit_price
  • unit_price_measurement
  • url
  • url_to_remove
  • variant
  • variant_id
  • vendor

מילוי הזמנה

יש לעיין ברשימה הבאה של מאפייני מילוי הזמנה הזמינים ב-Shopify Order Printer:

  • created_at. יש להשתמש במסנן date כדי לעצב את חותמת הזמן, לדוגמה באמצעות {{ fulfillment.created_at | date: "%B %e, %Y" }}.
  • estimated_delivery_at
  • fulfillment_line_items
  • item_count
  • line_items
  • requires_shipping
  • tracking_company
  • tracking_number
  • tracking_numbers
  • tracking_url
  • tracking_urls
  • updated_at

כתובת

יש לעיין ברשימה הבאה של מאפייני הכתובת (Address) שזמינים ב-Shopify Order Printer:

  • address1
  • address2
  • city
  • company
  • country
  • country_code
  • country_upper
  • errors
  • first_name
  • id
  • last_name
  • name
  • phone
  • province
  • province_code
  • street
  • summary
  • translated_country_name
  • translated_province_name
  • url
  • zip

לקוח

יש לעיין ברשימה הבאה של מאפייני הלקוח (Customer) שזמינים ב-Shopify Order Printer:

  • accepts_marketing
  • account_activation_url
  • addresses
  • addresses_count
  • b2b?
  • default_address
  • email
  • first_name
  • has_account
  • id
  • last_name
  • last_order
  • metafields
  • name
  • new_address
  • orders
  • orders_count
  • payment_methods
  • phone
  • reset_password_url
  • subscribe_url
  • tags
  • tax_exempt
  • total_spent

DiscountApplication

יש לעיין ברשימה הבאה של מאפייני ה-DiscountApplication שזמינים ב-Shopify Order Printer:

  • target_selection
  • target_type
  • title
  • total_allocated_amount
  • type
  • value_type
  • value

הדפסת הנחות

ניתן להחיל הנחות על ההזמנה כולה או על פריטי שורה ספציפיים:

  • הנחות ברמת ההזמנה: חלות על כל ההזמנה. ניתן להציג הנחות אלו בנפרד בתחתית בעת הדפסת חשבונית ההזמנה.
  • הנחות ברמת פריט השורה: חלות על פריטים בודדים. ניתן לציין הנחות אלו בעת הדפסת פרטי פריט בודד במקטע פריט השורה.

ניתן לגשת למידע על ההנחות באמצעות המשתנים הבאים:

  • כדי לגשת לכל ההנחות שהוחלו על ההזמנה או על כל אחד מפריטי השורה שלה, יש להשתמש בערך 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 %}

DiscountAllocation

יש לעיין ברשימה הבאה של מאפייני ה-DiscountAllocation שזמינים ב-Shopify Order Printer:

  • amount
  • discount_application

הנחה

יש לעיין ברשימה הבאה של מאפייני ההנחה (Discount) שזמינים ב-Shopify Order Printer:

  • amount
  • code
  • free_shipping_discount
  • id
  • savings
  • title
  • total_amount
  • total_savings

מוצר

יש לעיין ברשימה הבאה של מאפייני המוצר שזמינים ב-Shopify Order Printer:

  • as_json
  • available
  • collections
  • compare_at_price
  • compare_at_price_max
  • compare_at_price_min
  • compare_at_price_varies
  • content
  • created_at
  • description
  • featured_image
  • featured_media
  • first_available_variant
  • gift_card?
  • handle
  • has_only_default_variant
  • id
  • images
  • json_filter
  • media
  • metafields
  • object_type
  • options
  • options_by_name
  • options_with_values
  • price
  • price_max
  • price_min
  • price_varies
  • published_at
  • requires_selling_plan
  • selected_or_first_available_selling_plan_allocation
  • selected_or_first_available_variant
  • selected_selling_plan
  • selected_selling_plan_allocation
  • selected_variant
  • selling_plan_groups
  • tags
  • template_suffix
  • title
  • type
  • url
  • variants
  • vendor

גרסה

יש לעיין ברשימה הבאה של מאפייני הגרסה שזמינים ב-Shopify Order Printer:

  • as_json
  • available
  • barcode
  • compare_at_price
  • featured_image
  • featured_media
  • id
  • image
  • incoming
  • inventory_management
  • inventory_policy
  • inventory_quantity
  • json_filter
  • metafields
  • next_incoming_date
  • option1
  • option2
  • option3
  • options
  • price
  • product
  • requires_selling_plan
  • requires_shipping
  • selected_selling_plan_allocation
  • selling_plan_allocations
  • sku
  • store_availabilities
  • taxable
  • title
  • unit_price
  • unit_price_measurement
  • url
  • weight
  • weight_in_unit
  • weight_unit

החזר כספי

יש לעיין ברשימה הבאה של מאפייני ההחזרים הכספיים שזמינים ב-Shopify Order Printer:

  • amount
  • created_at
  • id
  • note
  • refund_line_items
  • restock
  • transactions

ShippingLine

יש לעיין ברשימה הבאה של מאפייני שורות השילוח שזמינים ב-Shopify Order Printer:

  • handle
  • id
  • original_price
  • price. יצא משימוש משום שהמחיר לא כלל הנחות ברמת ההזמנה. המאפיין shipping_line.price הוחלף במאפיין shipping_line.price_with_discounts.
  • price_with_discounts
  • tax_lines
  • title

TaxLine

יש לעיין ברשימה הבאה של מאפייני שורות המס שזמינים ב-Shopify Order Printer:

  • price
  • rate
  • rate_percentage
  • title

עסקה

יש לעיין ברשימה הבאה של מאפייני העסקאות שזמינים ב-Shopify Order Printer:

  • amount
  • buyer_pending_payment_instructions
  • buyer_pending_payment_notice
  • created_at
  • gateway
  • gateway_display_name
  • id
  • kind
  • name
  • payment_details
  • receipt
  • show_buyer_pending_payment_instructions
  • status
  • status_label

מטא שדה

מטא שדה המצורף לאובייקט אב. כדי ללמוד כיצד לגשת למטא שדה באובייקט ספציפי, יש לעיין בסעיף גישה למטא שדות.

מטא שדות תומכים בסוגי נתונים מרובים, אשר קובעים את סוג המידע המאוחסן במטא שדה. כדי לגשת למטא שדות, נתיב הגישה מורכב משתי שכבות:

  • מרחב שמות (namespace) - קבוצה של מטא שדות כדי למנוע התנגשויות,
  • מפתח (key) - שם המטא שדה.

לאור זאת, אפשר לגשת לאובייקט המטא שדה באמצעות התחביר הבא: {{ resource.metafields.namespace.key }}.

מתן שמות: <object>.metafields.<namespace>.<key>. לדוגמה, order.metafields.shipping.express_delivery_status.

סוגים:

  • String
  • Array - יש להשתמש ב-[ ] לאינדקס. לדוגמה, order.metafield.shipping.express_delivery_status[0]
  • Integer
  • Boolean
  • Date

הערה: סוג Metaobject אינו נתמך.

אובייקטים שתומכים במטא שדות:

  • Order
  • Customer
  • Product
  • Variant
  • Location

מסנני 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.

מסננים להחלה על כל טקסט / מחרוזת

  • camelcase
  • camelize
  • encode_url_component
  • format_code
  • handle
  • highlight
  • pad_spaces
  • paragraphize
  • pluralize
  • url_escape
  • url_param_escape

לדוגמאות לשימוש, עיינו בתיעוד של Liquid לערכות הנושא של Shopify בנושא מסנני מחרוזות.

מסננים להחלה על מספרים המייצגים כסף

  • money
  • money_with_currency
  • money_without_currency
  • money_without_trailing_zeros

Shopify Order Printer משתמש באפשרויות עיצוב המטבע של התראות אימייל המוגדרות במנהל של Shopify כדי לעצב כסף. ניתן לשנות את עיצוב המטבע. הגדירו את הערכים Email with currency ו-Email without currency במנהל של Shopify כדי לשנות את עיצוב מסנני הכסף ב-Shopify Order Printer.

לדוגמאות לשימוש, עיינו בתיעוד של Liquid לערכות הנושא של Shopify בנושא מסנני כסף.

מסננים להחלה כדי להמיר אובייקטים ל-json

  • json

לדוגמאות לשימוש, עיינו בתיעוד של Liquid לערכות הנושא של Shopify בנושא מסנני json.

מסננים להחלה על מספרים המייצגים משקל

  • weight
  • weight_with_unit

לדוגמאות לשימוש, עיינו בתיעוד של Liquid לערכות הנושא של Shopify בנושא משקל עם יחידת מידה.

מסננים להחלה על תגים

  • highlight_active_tag
  • link_to_add_tag
  • link_to_remove_tag
  • link_to_tag

לדוגמאות לשימוש, עיינו בתיעוד של Liquid לערכות הנושא של Shopify בנושא מסנני תגים.

מסננים להחלה על כתובות URL

  • article_img_url
  • asset_img_url
  • asset_url
  • cdn_asset_url
  • collection_img_url
  • file_img_url
  • file_url
  • global_asset_url
  • image_url
  • img_tag
  • img_url
  • link_to
  • payment_icon_png_url
  • payment_type_img_url
  • payment_type_svg_tag
  • placeholder_svg_tag
  • product_img_url
  • script_tag
  • shopify_asset_url
  • stylesheet_tag

לדוגמאות שימוש במסנני המדיה הנתמכים, יש לעיין בתיעוד של Liquid לערכות נושא של Shopify בנושא מסנני מדיה.

מסננים שיש להחיל על אוספים

  • link_to_type
  • link_to_vendor
  • sort_by
  • url_for_type
  • url_for_vendor
  • within

לדוגמאות לשימוש, עיינו בתיעוד של Liquid לערכות הנושא של Shopify בנושא מסנני קולקציות.