• Resolved scott74

    (@scott74)


    Looking for a way to display the customer ID of the logged in user on the My Account Page. Any help appreciated. Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi @scott74,

    There is no such option by default in WooCommerce so you will need to apply a bit of additional code customization to achieve it. You can use something like this:

    
    <?php echo 'Customer ID: ' . get_current_user_id(); ?>
    

    You can create a child theme and the template to override is this one: wp-content/plugins/woocommerce/templates/myaccount/dashboard.php`.

    Hope this helps.

    Thread Starter scott74

    (@scott74)

    Thanks so is user ID the same as customer ID? I did find a setting in elementor that inserts user ID but did not know if that walways coorelates with cusetom ID and need to be sure ss the users need to copy their customer ID and enter it into a applicatication I use to authenticate them

    Thanks for the help..

    PS>> your php code above that just goes anywher on a page and will render out of you have to coy the dashboard.php file over to a child theme?

    Mirko P.

    (@rainfallnixfig)

    Hi @scott74,

    Well, yes the Customer ID is the User ID and you can check this value in WP Admin > Users > hover the username:


    Link to image: https://i.imgur.com/450aRdM.png

    your php code above that just goes anywher on a page and will render out of you have to coy the dashboard.php file over to a child theme?

    You’ll need to paste the code in the part of the dashboard.php page where you’d like the Customer ID to be displayed. It’s definitely better to use a child theme to avoid changing the default core template that will be overwritten when WooCommerce is updated.

    Hope this helps.

    Thread Starter scott74

    (@scott74)

    Ah, thank you very much. Just wanted to be sure that never changed as I’m heavily reliant of the customer using that ID in an app I licenesed. They need to enter that in the app so that we can go look up teir current subscription package through the woo commerce API.

    Th;anksk for the TIP.

    Plugin Support B C. a11n

    (@battouly)

    Hi @scott74,

    It looks like everything is alright.

    I’m going to mark this as resolved. If you have any further questions, you can start a new thread.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add Customer ID to My Account Page’ is closed to new replies.