• Resolved mor3311

    (@mor3311)


    Hello,
    I added to my custom form a “company name” input field, and I would like to get it from the users’ metadata on the backend, using php.
    How can I achieve that?

    the following does not work:

    $order_id = $order->get_id();
    $user_id = get_post_meta($order_id, ‘_customer_user’, true);

    $store_name = get_user_meta( $user_id, ‘company_name’, true );

    and neither the following:

    $user_id = $order->get_user_id();
    $store_name = get_user_meta( $user_id, ‘company_name’, true );

    Thanks, Mor.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Amrit Kumar Shrestha

    (@shresthauzwal)

    Hi @mor3311,

    If you have added the custom field on the user registration form and the form field name is ‘company_name’, then you will need to add ‘user_registration” as a prefix to get the custom field values from your metadata.

    For more clarification, please use ‘user_registration_company_name’ to get the company field metadata. I hope this helps.

    Regards!

    Plugin Support Amrit Kumar Shrestha

    (@shresthauzwal)

    Hi @mor3311,

    Since we did not get a response from your end, we are marking this thread as resolved as we believe the things mentioned here are now resolved. Please create a new support thread if needed.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get company name using php’ is closed to new replies.