Jens

My feedback

  1. 12 votes
    Vote
    Sign in
    (thinking…)
    Sign in with: facebook google
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    0 comments  ·  WooCommerce » Category - Extension Ideas  ·  Flag idea as inappropriate…  ·  Admin →
    Jens shared this idea  · 
  2. 126 votes
    Vote
    Sign in
    (thinking…)
    Sign in with: facebook google
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    17 comments  ·  WooCommerce » Category - Extension Ideas  ·  Flag idea as inappropriate…  ·  Admin →
    Jens commented  · 

    I agree. This feature totally makes sense.
    For a quick fix, you can simply add it to the user meta with the following functions:

    add_action( 'woocommerce_customer_save_address', 'pp_customer_save_address');
    function pp_customer_save_address ($user_id) {
    update_user_meta( $user_id, 'vat_number', htmlentities($_POST['vat_number']) );
    }

    add_action('woocommerce_checkout_update_user_meta', 'pp_custom_checkout_update_user_meta');
    function pp_custom_checkout_update_user_meta( $user_id ) {
    if ($user_id && $_POST['vat_number']) {
    update_user_meta( $user_id, 'vat_number', esc_attr($_POST['vat_number']) );
    }
    }

    Additionally, you should show the field in the admin panel and include it into the billing address - at least that's what I did.

Feedback and Knowledge Base