LoginSignup
3
1

More than 3 years have passed since last update.

WooCommerce の注文請求者情報の関数【取得系】

Last updated at Posted at 2019-06-12

注文に紐づく請求者情報の取得

ここから記載する \$order は、WooCommerce の注文関連の関数【取得系】で取得したものとします。
バージョンは3.0.0以降の情報となります。【2019/06/12現在】

請求者情報の取得

請求者名

functions.php
$billing_first_name = $order->get_billing_first_name();

請求者姓

functions.php
$billing_first_name = $order->get_billing_last_name();

請求先会社名

functions.php
$billing_first_name = $order->get_billing_company();

請求先住所(国)

functions.php
$billing_first_name = $order->get_billing_country();

請求先住所(郵便番号)

functions.php
$billing_first_name = $order->get_billing_postcode();

請求先住所(都道府県/州)

こちらは、それぞれのコードになりますので、表示用にするには、ひと手間が掛かります。

functions.php
$billing_first_name = $order->get_billing_state();

請求先住所(市)

functions.php
$billing_first_name = $order->get_billing_city();

請求先住所(住所詳細1)

functions.php
$billing_first_name = $order->get_billing_address_1();

請求先住所(住所詳細2)

functions.php
$billing_first_name = $order->get_billing_address_2();

請求先住所(メールアドレス)

functions.php
$billing_first_name = $order->get_billing_email();

請求先住所(電話番号)

functions.php
$billing_first_name = $order->get_billing_phone();

請求先その他情報

$propを設定されているデフォルト以外の項目とした場合、これで取得できます。

functions.php
$billing_first_name = $order->get_address_prop( $prop, 'billing');
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1