Skip to content
Advertisement

Disable or make read only the fields from edit account pages in Woocommerce

Currently the Edit Account Details page have these fields: First Name, Last Name, Email address, Current Password & New Password.

Now I need to disable the First Name, Last Name, Email address fields for customers user only. I am using Flatsome WP theme and Woocommerce plugins.

How can I do this?

Advertisement

Answer

Update

For edit “Account details” fields (email field), you will need to edit myaccount/form-edit-account.php template file as those fields are hard coded in the template

You will have to add a readonly attribute to the related input fields like in this extract example:

JavaScript
JavaScript

Official documentation: Overriding templates via a theme

For My account > edit billing address, the following code will make readonly the billing fields first name, last name and email:

JavaScript

Code goes in function.php file of your active child theme (or active theme). Tested and works.

Note: To enable that on checkout page too, Just remove if( is_account_page() ){ and the closing bracket } before return $billing_fields;.


To remove those 3 fields you will use:

JavaScript

Code goes in function.php file of your active child theme (or active theme). Tested and works.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement