WooCommerceのお客様は基本的に余分なメタデータを持つWordPressユーザーです。したがって、ユーザーが作成されると、update_user_meta
機能を使用してメタデータを追加できます。ユーザー - >すべてのユーザーに移動し、ユーザーの1人を編集してから、下にスクロールしてフィールドを表示します。
以下のコードを作成して、どのように動作するかを説明します。ここで
$user_id = wc_create_new_customer($email, $username, $password);
update_user_meta($user_id, "billing_first_name", 'God');
update_user_meta($user_id, "billing_last_name", 'Almighty');
.... more fields
は、請求先住所と配送フィールドの完全なリストである
課金
- billing_first_name
- billing_last_name
- billing_company
- billing_address_1
- billing_address_2
- billing_city
- billing_postcode
- billing_country
- billing_state
- billing_phone
送料
billing_email 10
- shipping_first_name
- shipping_last_name
- shipping_company
- shipping_address_1
- shipping_address_2
- shipping_city
- shipping_postcode
- shipping_country
- shipping_state
ありがとうございます。私は昼食時に同じ結論に達しましたが、私はそれを見ている将来のユーザーのためにあなたの答えを記します。 –
ありがとう、幸せなコーディング:) –
@AnandShahは、このフィールドのリストを入手した場所からのリンクで返信していただけますか?できるだけ早くそれをしてください。 –