How to upload WP user avatar on woocommerce account page


I am using WP User Avatar Plugin instead of gravatar for user profile.

But gravatar is not working so well.
I want to add image upload field on woocommerce account page.

How can I do that?
Please help.


in progress 0
liming 1 year 2021-04-21T20:46:37-05:00 0 Answer 0 views 0

Answer ( 1 )


    Open up your functions.php file located in wp-content/themes/your-theme-name/ and add this code in it:

    function storefront_myaccount_customer_avatar() {
         $current_user = wp_get_current_user();
         echo '
    ' . get_avatar( $current_user->user_email, 72, '', $current_user->display_name ) . '
    '; } add_action( 'woocommerce_account_content', 'storefront_myaccount_customer_avatar', 5 );

    Then open your style.css file in the same path and add this code:

    .myaccount_avatar {
        border-right: 1px solid rgba(0, 0, 0, 0.1);
        float: left;
        padding-right: 10px;
        margin-right: 10px;
        width: 83px;

Leave an answer