メインコンテンツにスキップ
バージョン: 1.x

レシートデータリファレンス

WCPOSのロジックレスHTMLテンプレートとサーマルXMLテンプレートは、同一の正規レシートペイロードからレンダリングされます。{{order.number}}{{store.name}}{{totals.total_display}}のようなMustacheドットパスを使用します。配列はセクションでレンダリングされます:

{{#lines}}
{{name}} x {{qty}} — {{line_total_display}}
{{/lines}}

正規コントラクトはサーバー上のWCPOSレシートデータビルダーによって生成され、アプリ内のオフラインレシートレンダラーによってミラーリングされます。レシートはローカルデータからすぐに表示され、サーバーレスポンスが利用可能になると更新されるため、カスタムテンプレートではPHPの注文メソッドではなく以下のフィールドを使用してください。

レンダリングルール

通貨フィールド

数値の金額フィールドは数値として保持され、レンダラーがテンプレート出力用にロケール対応の_displayフィールドを追加します:

数値フィールド表示フィールド
totals.totaltotals.total_display
lines[].line_totallines[].line_total_display
payments[].amountpayments[].amount_display
tax_summary[].tax_amounttax_summary[].tax_amount_display

レシート印刷時は _display フィールドを使用してください。数値フィールドは条件付きセクションや機械可読出力にのみ使用します。

税表示対応フィールド

いくつかのフィールドには税込・税抜のバリアントに加え、表示用の便利な値があります。この便利な値は、店舗のカート税表示設定に従います。

便利フィールド税込フィールド税抜フィールド
lines[].unit_pricelines[].unit_price_incllines[].unit_price_excl
lines[].unit_subtotallines[].unit_subtotal_incllines[].unit_subtotal_excl
lines[].line_subtotallines[].line_subtotal_incllines[].line_subtotal_excl
lines[].discountslines[].discounts_incllines[].discounts_excl
lines[].line_totallines[].line_total_incllines[].line_total_excl
fees[].totalfees[].total_inclfees[].total_excl
shipping[].totalshipping[].total_inclshipping[].total_excl
discounts[].totaldiscounts[].total_incldiscounts[].total_excl
totals.subtotaltotals.subtotal_incltotals.subtotal_excl
totals.discount_totaltotals.discount_total_incltotals.discount_total_excl
totals.totaltotals.total_incltotals.total_excl

日付オブジェクト

日付フィールドは、複数のフォーマット済みバリアントを持つオブジェクトです。これにより、Mustache 内での日付フォーマット処理が不要になります。

フィールド説明
datetimedatetimeデフォルトの日付/時刻文字列
datetime_shortdatetime_longdatetime_fullロケール対応の結合フォーマット
date_short, date_long, date_fullロケール対応の日付のみのフォーマット
date_ymd, date_dmy, date_mdy固定順序の日付フォーマット
weekday_short, weekday_long曜日名
day, month, month_short, month_long, year個別の日付要素

利用可能な日付オブジェクト: order.createdorder.paidorder.completedorder.printed、および refunds[].dateorder.printed はレンダリング時に更新されるため、再印刷時に便利です。

トップレベルセクション

セクション説明
orderobject注文のID、ステータス、日付、メモ、および決済URL情報
storeobject店舗のID、住所、連絡先、税務ID、ロゴ、営業時間、およびフッターテキスト
cashierobject注文を処理したユーザー
customerobject顧客の表示名、住所、および税務ID
linesarray商品明細行
feesarray手数料行
shippingarray配送料行
discountsarrayクーポン/割引行
totalsobject注文合計、支払合計、返金概要、および項目数
taxobjectセクションガード用の税表示モードフラグ
tax_summaryarray税率別の税概要行
has_tax_summarybooleantax_summary の有無を示す簡易ガード
paymentsarray支払行
refundsarray注文に適用された返金レコード
fiscalobject財務連携により設定されるフィスカルスナップショットフィールド
presentation_hintsobject書式設定およびレンダラーヒント
i18nobject組み込みテンプレートおよびカスタムテンプレート用の翻訳ラベル

order

フィールド例 / 説明
order.idnumber1234
order.numberstring表示用の注文番号(例: "10045"
order.currencystringISO 通貨コード(例: "USD"
order.customer_notestring顧客メモ / 注文メモ
order.wc_statusstringWooCommerce のステータススラッグ(例: "processing"
order.status_labelstringローカライズされたステータスラベル(カスタムステータスを含む)
order.created_viastring作成元 / チャネル(例: "woocommerce-pos"
order.needs_paymentboolean支払いセクションを表示するかどうか
order.payment_urlstring利用可能な場合の注文決済 URL
order.createddate object注文作成日
order.paiddate object支払日、未払いの場合は空文字列
order.completeddate object完了日、未完了の場合は空文字列
order.printeddate objectレンダリング時の印刷/再印刷タイムスタンプ

店舗

フィールド例 / 説明
store.idnumber店舗 ID、削除済み店舗の場合は過去の ID
store.namestring店舗の表示名
store.address.address_1string住所1行目
store.address.address_2string建物名・部屋番号
store.address.citystring市区町村
store.address.statestring都道府県/地域
store.address.postcodestring郵便番号
store.address.countrystringISO 国コード
store.address_linesarrayフォーマット済みの住所行。ほとんどのテンプレートで推奨
store.tax_idsarray構造化された事業者税務ID。単一の税務IDではなくループで使用
store.phonestring店舗電話番号
store.emailstring店舗メールアドレス
store.logostring/null店舗ロゴのURLまたはデータURI
store.opening_hoursstring/null営業時間テキスト(コンパクト形式)
store.opening_hours_verticalstring/null営業時間ブロック(複数行形式)
store.opening_hours_inlinestring/null営業時間テキスト(カンマ区切り形式)
store.opening_hours_notesstring/null営業時間に関する自由記述メモ
store.personal_notesstring/nullレシートフッター/個人メモ
store.policies_and_conditionsstring/null返金・返品・利用規約テキスト
store.footer_imprintstring/null法的フッターインプリント

税務IDオブジェクト

store.tax_idscustomer.tax_ids は同じ構造のオブジェクトを含みます:

フィールド説明
typestringeu_vatde_steuernummerau_abnbr_cpfus_einother などの識別子
valuestring印刷する税務ID値
countrystring/null判明している場合のISO国コード
labelstring/nullローカライズされた表示ラベル(レンダリング前に解決済み)

例:

{{#store.tax_ids}}
{{label}}: {{value}}
{{/store.tax_ids}}

cashier

フィールド例 / 説明
cashier.idnumberWordPress ユーザー ID、不明な場合は 0
cashier.namestringレジ担当者の表示名

customer

フィールド例 / 説明
customer.idnumber/null顧客 ID、ゲストの場合は null
customer.namestring顧客の表示名、またはゲストラベル
customer.billing_address.*objectWooCommerce の請求先住所フィールド
customer.shipping_address.*objectWooCommerce の配送先住所フィールド
customer.tax_idsarray注文からスナップショットされた顧客の税 ID(構造化データ)

一般的な住所キーには first_namelast_namecompanyaddress_1address_2citystatepostcodecountryemailphone があります。

lines

{{#lines}}...{{/lines}} でループします。

フィールド説明
keystring固定の明細キー/注文アイテム ID
skustring商品 SKU
namestring商品名または明細の表示名
qtynumber販売数量
qty_refundednumberこの明細の返金数量
unit_subtotal / _incl / _exclnumber割引前単価
unit_price / _incl / _exclnumber割引後単価
line_subtotal / _incl / _exclnumber割引前明細小計
discounts / _incl / _exclnumber割引額(正の値)
line_total / _incl / _exclnumber明細合計
total_refundednumberこの明細の返金合計(正の値)
taxesarrayこの明細の税率別税額行
metaarray注文項目メタ({key, value} ペア)
attributesarray商品/バリエーション属性({key, value} ペア)

フォーマット済みバリアントには unit_subtotal_displayunit_price_displayline_subtotal_displaydiscounts_displayline_total_display、および税込/税抜の _display バリアントがあります。

手数料と配送

{{#fees}}...{{/fees}} および {{#shipping}}...{{/shipping}} でループします。

フィールド説明
labelstring手数料ラベルまたは配送方法名
method_idstring配送方法ID(配送のみ)
total / _incl / _exclnumber表示用、税込、税抜の合計
taxesarray税率ごとの税額行
metaarray{key, value} メタデータのペア

フォーマット済みバリアント: total_displaytotal_incl_displaytotal_excl_display

discounts

{{#discounts}}...{{/discounts}} でループします。

フィールド説明
labelstringクーポンの説明またはコードのフォールバック
codestringクーポンコード
codesstring結合されたコードのレガシー/表示フォールバック
total / _incl / _exclnumber正の値としての割引額

フォーマット済みバリアント: total_displaytotal_incl_displaytotal_excl_display。割引をマイナス行として表示する場合は、テンプレート内で独自にマイナス記号を追加してください。

totals

フィールド説明
totals.subtotal / _incl / _exclnumber割引前の注文小計
totals.discount_total / _incl / _exclnumber正の値としての注文割引合計
totals.tax_totalnumber税額合計
totals.total / _incl / _exclnumber注文総計
totals.paid_totalnumber支払済み/適用済み金額
totals.change_totalnumber顧客へのお釣り
totals.refund_totalnumber返金合計(正の値)
totals.net_totalnumbertotal - refund_total(ゼロ以上に制限)
totals.total_qtynumber明細数量の合計
totals.line_countnumber商品明細行の数

フォーマット済みバリアントとして subtotal_displaydiscount_total_displaytax_total_displaytotal_displaypaid_total_displaychange_total_displayrefund_total_displaynet_total_display があり、該当する場合は税込/税抜バリアントも含まれます。

tax と tax_summary

表示モードの判定には tax を、税率別の明細行には tax_summary を使用します。

税フィールド説明
tax.displaystringincl または excl
tax.display_inclboolean価格が税込みで表示される場合に true
tax.display_exclboolean価格が税抜きで表示される場合に true
tax.breakdownstringhiddensingle、または itemized
tax.breakdown_hiddenboolean税の行を非表示にする場合に true
tax.breakdown_singleboolean税合計を一行で表示する場合に true
tax.breakdown_itemizedboolean税率ごとの行を表示する場合に true
has_tax_summarybooleantax_summary に行が含まれる場合に true

tax_summary{{#tax_summary}}...{{/tax_summary}} でループします。

フィールド説明
codestring税率 ID/コード
ratenumber/null解決済みの場合の税率(パーセント)
labelstring税率ラベル
compoundboolean複合税率かどうか
taxable_amount_exclnumber/null税抜課税対象額
tax_amountnumber徴収税額
taxable_amount_inclnumber/null税込課税対象額

フォーマット済みバリアント: taxable_amount_excl_displaytax_amount_displaytaxable_amount_incl_display

payments

{{#payments}}...{{/payments}} でループします。

フィールド説明
method_idstring決済方法の識別子
method_titlestring決済方法の表示名
amountnumber注文に適用された金額
transaction_idstringゲートウェイのトランザクション ID
tenderednumber現金の預かり金額(存在する場合)
changenumber現金のお釣り(存在する場合)

フォーマット済みバリアント: amount_displaytendered_displaychange_display

返金

{{#refunds}}...{{/refunds}} でループします。返金額は正の絶対値です。マイナス記号を付けるか、返品ブロックとして別に表示するかはテンプレート側で決定します。

フィールド説明
idnumber返金レコード ID
datedate object返金作成日
amountnumber返金合計
subtotalnumber返金された明細小計
tax_totalnumber返金された税額
shipping_totalnumber返金された送料
shipping_taxnumber返金された送料税
reasonstring返金理由
refunded_by_idnumber/null返金を実行したユーザーのID
refunded_by_namestring返金を実行したユーザーの表示名
refunded_paymentbooleanゲートウェイ経由で返金が処理されたかどうか
destinationstringoriginal_methodcash、または manual
gateway_idstring返金に使用されたゲートウェイID
gateway_titlestringゲートウェイの表示タイトル
processing_modestringプロバイダー/手動処理モード
linesarray返金対象の商品行
feesarray返金対象の手数料行
shippingarray返金対象の配送料行

返金明細行のフィールドには nameskuqtytotaltotal_incltotal_exclline_totalunit_total、および taxes があります。返金手数料行および配送料行では labeltotaltotal_incltotal_excl、および taxes が使用されます。合計金額および税額には表示用のバリアントが追加されます。

fiscal

fiscal フィールドはデフォルトでは空であり、財務連携機能または WCPOS Pro のスナップショットエンリッチメントによって値が設定されます。

フィールド説明
fiscal.immutable_idstring不変の財務識別子
fiscal.receipt_numberstring財務レシート番号
fiscal.sequencenumber/nullシーケンスカウンター
fiscal.hashstringハッシュ/署名値
fiscal.qr_payloadstring財務検証用QRペイロード
fiscal.tax_agency_codestring税務当局コード
fiscal.signed_atstring財務署名タイムスタンプ
fiscal.signature_excerptstring表示用の短縮署名
fiscal.document_labelstringドキュメントラベル(例:Tax Invoice)
fiscal.is_reprintboolean再印刷かどうか
fiscal.reprint_countnumber再印刷回数
fiscal.extra_fieldsarray/object管轄区域固有の値

presentation_hints

これらのフィールドは主にレンダラーとフォーマッターによって使用されます。必要に応じてテンプレートからも利用できます。

フィールド説明
presentation_hints.display_taxstringinclexclhiddenitemized、または single
presentation_hints.prices_entered_with_taxbooleanカタログ価格に税が含まれているかどうか
presentation_hints.rounding_modestringWooCommerce の税端数処理設定
presentation_hints.localestringフォーマットに使用されるロケール
presentation_hints.timezonestringレシートのタイムゾーン
presentation_hints.currency_positionstring通貨記号の位置
presentation_hints.currency_symbolstring通貨記号
presentation_hints.price_thousand_separatorstring桁区切り文字
presentation_hints.price_decimal_separatorstring小数点記号
presentation_hints.price_num_decimalsnumber小数点以下の桁数
presentation_hints.price_display_suffixstringWooCommerce の価格表示サフィックス
presentation_hints.order_barcode_typestringギャラリーテンプレートで使用されるバーコードの種類

i18n

テキストをハードコードせず、可能な限り i18n ラベルを使用してください:

{{i18n.order}} #{{order.number}}
{{i18n.cashier}}: {{cashier.name}}
{{i18n.total}}: {{totals.total_display}}

一般的なキーには orderdatecashiercustomeritemskuqtyunit_pricediscountsubtotaltotaltaxpaidtenderedchangetax_summaryrefundednet_totalcustomer_notethank_you_purchaseopening_hours、および store_tax_id_label_eu_vatcustomer_tax_id_label_other などの税 ID ラベルキーがあります。拡張機能によってキーが追加される場合もあります。