Check if loggedin user has VAT number verified

Top WooCommerce & WordPress Plugins Forums EU/UK VAT Manager for WooCommerce Check if loggedin user has VAT number verified

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #134008
    blanksquashtoppertje
    Participant

    Hi,

    I would like to check on pages of the logged in user has a verified VAT number. Usecases: if a VAT number is verified it is a business and I can show prices excl. VAT. Or I can show texts based on their status as having their VAT verified or NOT.

    How can I check if this is the case? Is it in the data of the user? (In the variables/array?) Or somewhere else?

    Can you share some ideas about this?

    Thanks!

    #134080
    blanksquashtoppertje
    Participant

    Hi,

    So I found out it is stored as a user_meta.

    If anyone else wants to know this, this is my solution:

    global $user;
    $meta_key = ‘billing_eu_vat_number’;
    $user_id = get_current_user_id();
    if ( is_user_logged_in() ) {
    if ( metadata_exists( ‘user’, $user_id, $meta_key ) ) {
    print_r(“Do something!”);
    } else {
    print_r(“Do something else!”);
    }
    }

    #134176
    blankMoshtafizur
    Moderator
    Plugin Support

    Hi there,

    We didn’t get any notification of this query.

    But I am happy to know the issue has been resolved.

    Kind regards.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.