• Resolved delaitec

    (@delaitec)


    In this link:
    https://woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/

    it is explained how to customize the address fields of the “Checkout” page, as well as the ADDRESS option of the “My Account” page.

    However, on the “Account Details” page:
    [MY ACCOUNT] > [ACCOUNT DETAILS]:
    Cannot customize [FIRST NAME], [LAST NAME], [DISPLAY NAME], [EMAIL] fields, etc

    I would like to change the field classes so that the [DISPLAY NAME] occupies half of the screen, and to the right of it, the field [EMAIL].

    In the same way,
    I would like to position the field [NEW PASSWORD] on the left side, and on the right side [CONFIRM NEW PASSWORD].

    However, it is not possible to do this on this page using the filters below:
    woocommerce_checkout_fields
    woocommerce_default_address_fields
    woocommerce_shipping_fields
    woocommerce_billing_fields

    Can anyone help me with this?

    The page I need help with: [log in to see the link]

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

    (@rainfallnixfig)

    Hi there ??

    At the moment, there’s no default option to customize the account details section under the “My Account” page in WooCommerce, and customizing that would require a bit of additional coding or a plugin. Custom coding goes beyond the scope of support we are able to provide in this forum.

    For plugins you may want to look at the following:

    * My Account Page Editor
    * Customize My Account for WooCommerce

    A visual hook guide for that section can be found here. If you require more help with the actual coding, we’d recommend hiring a developer or one of the customization experts listed at https://woocommerce.com/customizations/.

    Cheers.

    Thread Starter delaitec

    (@delaitec)

    Hi Mirko,

    I greatly appreciate your help, the link you provided with the HOOKs is only for adding content, and may be useful in the future.

    But at the moment I need information about filters so that I can customize the contents, as explained in this material:
    https://woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/

    As for hiring a programmer, most of the times I come to ask for help here, they tell me the same thing, and I appreciate the suggestion, but in all cases, I managed to solve it only with the help of the users.

    I could do this using CSS, or Customizing the page code, but I would really like some guidance on how to do this correctly, using filters or another method indicated by Woocommerce.

    For example: I’ve already found a Filter that hides the fields on this page, it’s the:
    woocommerce_save_account_details_required_fields

    Here is the material link:
    https://rudrastyh.com/woocommerce/edit-account-fields.html
    But I couldn’t change the field class using this filter, see what I tried:

    add_filter('woocommerce_save_account_details_required_fields', 'change_class');
    
    function change_class( $fields ) {
    	$fields['account_display_name']['class'][0] = 'form-row-first'; 
    	$fields['account_email']['class'][0] = 'form-row-last'; 
    
    	return $fields;
    }

    If there’s really no way to customize these fields, as you can with address fields, I’ll do it via css.

    But before closing, I would like to wait a little longer,
    maybe someone else has an idea of ??how to do this or give me a better direction as before, in the end the answer may help others who have the same question.

    Have a great Day! And Thankyou again.

    Hi @delaitec

    Thanks for the update.

    As for CSS, we recommend using the free tutorials at w3schools. Here, you can find the selectors (how to target the right element on the page), and properties (how to change the element on the page).

    Since support for custom code is not covered in this forum, as you mentioned, we’re going to leave this thread open for a bit to see if anyone is able to chime in to help you out here.

    Thread Starter delaitec

    (@delaitec)

    Thanks for compreention ??

    Hey @delaitec,

    Looking through the forum I ran across this thread and did want to clarify this just a bit. The account details endpoint is created from this WooCommerce template:

    https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/templates/myaccount/form-edit-account.php

    If you look at the HTML here, these fields aren’t added programmatically. They are hard coded and there aren’t any filters for adding classes to the elements.

    The best option would be just to target this form with CSS to make the changes or use a template override in the theme to change the structure directly. It’s not a situation where it’ll be possible to change this via a function.

    I hope that helps out.

    Thread Starter delaitec

    (@delaitec)

    Hello @3sonsdevelopment

    Thank you so much for the help and clarification, this is what I was looking for.

    Discarding the change via function, I’ll follow the CSS path.

    When I’m done, I’ll post the code here in case anyone looks for it in the future.

    Thanks and have a great weekend.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Unable to change the field class on the MY ACCOUNT page’ is closed to new replies.