totals-footer-item
合計フッター項目
以下の合計フッター項目フィルターが利用可能です:
totalLabeltotalValue。
totalLabel
フィルターには以下のオブジェクトが使用される:
説明
totalLabelフィルターは、カートブロックとチェックアウトブロックのフッターで合計項目のラベルを変更することができます。
パラメーター
- defaultValue
string(デフォルト:Total) – ラベルの合計。 - extensions
object(default:{}) – 拡張オブジェクト。 - args
object– 以下のキーを持つ引数オブジェクト:- cart
object– カートオブジェクトを参照してください。
- cart
リターン
string– 更新された合計ラベル。
コード例
const { registerCheckoutFilters } = window.wc.blocksCheckout;
const modifyTotalLabel = ( defaultValue, extensions, args ) => {
return 'Deposit due today';
};
registerCheckoutFilters( 'example-extension', {
totalLabel: modifyTotalLabel,
} );
フィルターは組み合わせることもできます。例としてCombined filtersを参照してください。
スクリーンショット
| 前
|:———————————————————————:|:———————————————————————:|
| |
||…
totalValue
フィルターには以下のオブジェクトが使用される:
説明
totalValueフィルターは、カートブロックとチェックアウトブロックのフッターで合計金額をフォーマットすることができます。
パラメーター
- defaultValue
string(デフォルト:Total) – ラベルの合計。 - extensions
object(default:{}) – 拡張オブジェクト。 - args
object– 以下のキーを持つ引数オブジェクト:- cart
object– カートオブジェクトを参照ください。
- cart
- validation
boolean– 返り値が部分文字列<price/>を含むかどうかをチェックします。
リターン
string– 修正された合計価格のフォーマットで、<price/>の部分文字列、または元の価格のフォーマットを含む必要があります。
コード例
const { registerCheckoutFilters } = window.wc.blocksCheckout;
const modifyTotalsPrice = ( defaultValue, extensions, args, validation ) => {
return 'Pay <price/> now';
};
registerCheckoutFilters( 'my-extension', {
totalValue: modifyTotalsPrice,
} );
フィルターは組み合わせることもできます。例としてCombined filtersを参照してください。
スクリーンショット
| 前
|:———————————————————————:|:———————————————————————:|
| |
||…
カートオブジェクト
上記のフィルターのCartオブジェクトは以下のキーを持つ:
- billingAddress
object– 以下のキーを持つ請求先住所オブジェクト:- address_1
string– 住所の1行目。 - address_2
string– 住所の2行目。 - city
string– 住所の都市。 - company
string– 住所の会社。 - country
string– 住所の国。 - email
string– 住所のEメール。 - first_name
string– 住所の姓。 - last_name
string– 住所の姓。 - phone
string– 住所の電話番号。 - postcode
string– 住所の郵便番号。 - state
string– 住所の都道府県。
- address_1
billingDataobject–billingAddressオブジェクトと同じキーを持つ請求データオブジェクト。- cartCoupons
array– カートクーポンの配列。 - cartErrors
array– カートのエラー配列。 - cartFees
array– カート料金の配列。 - cartHasCalculatedShipping
boolean– カートが送料を計算しているかどうか。 - cartIsLoading
boolean– カートが読み込まれているかどうか。 - cartItemErrors
array– カート項目のエラー配列。 - カートアイテムオブジェクト を参照ください。
- cartItemsCount
number– カートアイテムの数。 - cartItemsWeight
number– カートアイテムの重さ。 - cartNeedsPayment
boolean– カートに支払いが必要かどうか。 - cartNeedsShipping
boolean– カートに配送が必要かどうか。 - cartTotals
object– 以下のキーを持つカート合計オブジェクト:- currency_code
string– 通貨コード。 - currency_decimal_separator
string– 通貨の小数点セパレータ。 - currency_minor_unit
number– 通貨の小単位。 - currency_prefix
string– 通貨のプレフィックス。 - currency_suffix
string– 通貨のサフィックス。 - currency_symbol
string– 通貨記号。 - currency_thousand_separator
string– 通貨の千の区切り文字。 - tax_lines
array– 以下のキーを持つ税目オブジェクトを含む税目配列:- name
string– タックスラインの名前。 - price
number– タックスラインの価格。 - rate
string– タックス・ラインの税率ID。
- name
- total_discount
string– 割引総額。 - total_discount_tax
string– 割引税の合計。 - total_fees
string– 料金合計。 - total_fees_tax
string– 料金にかかる税金の合計。 - total_items
string– 合計アイテム。 - total_items_tax
string– 合計商品税。 - total_price
string– 合計価格。 - total_shipping
string– 送料の合計。 - total_shipping_tax
string– 配送にかかる税金の合計。 - total_tax
string– 合計税金。
- currency_code
- crossSellsProducts
array– クロスセル商品オブジェクトを含むクロスセル商品配列。 - extensions
object(default:{}) – 拡張オブジェクト。 - isLoadingRates
boolean– カートが配送料金を読み込んでいるかどうか。 - paymentRequirements
array– 支払い条件の配列。 - shippingAddress
object–billingAddressオブジェクトと同じキーを持つ配送先住所オブジェクト。 - shippingRates
array– 配送料金の配列。
カートアイテムオブジェクト
上記のフィルターの Cart Item オブジェクトは以下のキーを持ちます:
- backorders_allowed
boolean– バックオーダーを許可するかどうか。 - catalog_visibility
string– カタログの表示。 - decsription
string– カートアイテムの説明。 - extensions
object(default:{}) – 拡張オブジェクト。 - id
number– アイテムID。 - images
array– アイテムの画像配列。 - item_data
array– アイテムデータの配列。 - key
string– アイテムのキー。 - low_stock_remaining
number– 残りの在庫数。 - name
string– アイテム名。 - permalink
string– アイテムのパーマリンク。 - prices
object– 以下のキーを持つアイテム価格オブジェクト:- currency_code
string– 通貨コード。 - currency_decimal_separator
string– 通貨の小数点セパレータ。 - currency_minor_unit
number– 通貨の小単位。 - currency_prefix
string– 通貨のプレフィックス。 - currency_suffix
string– 通貨のサフィックス。 - currency_symbol
string– 通貨記号。 - currency_thousand_separator
string– 通貨の千単位区切り文字。 - price
string– 価格。 - price_range
string– 価格帯。 - raw_prices
object– 以下のキーを持つ生の価格オブジェクト:- precision
number– 精度。 - price
number– 価格。 - regular_price
number– 通常価格。 - sale_price
number– セール価格。
- precision
- regular_price
string– 通常価格。 - sale_price
string– セール価格。
- currency_code
- quantity
number– 商品の数量。 - quantity_limits
object– 以下のキーを持つ数量制限オブジェクトです:- editable
boolean– 数量を編集可能かどうか。 - maximum
number– 最大数量。 - minimum
number– 最小量。 - multiple_of
number– 数量の倍数。
- editable
- short_description
string– 商品の短い説明。 - show_backorder_badge
boolean– バックオーダーのバッジを表示するかどうか。 - sku
string– 商品のSKU。 - sold_individually
boolean– アイテムが個別に販売されているかどうか。 - totals
object– 以下のキーを持つ項目の合計オブジェクトです:- currency_code
string– 通貨コード。 - currency_decimal_separator
string– 通貨の小数点セパレータ。 - currency_minor_unit
number– 通貨の小単位。 - currency_prefix
string– 通貨のプレフィックス。 - currency_suffix
string– 通貨のサフィックス。 - currency_symbol
string– 通貨記号。 - currency_thousand_separator
string– 通貨の千の区切り文字。 - line_subtotal
string– 行の小計。 - line_subtotal_tax
string– 行の小計の税金。 - line_total
string– 行の合計。 - line_total_tax
string– 行の合計税額。
- currency_code
- type
string– 商品のタイプ。 - variation
array– 項目のバリエーション配列。
