Duplicate IDs on My Account Page (Login/Register Forms)

This topic has 6 replies, 3 voices, and was last updated 1 months, 2 weeks ago ago by Tony Rodriguez

  • Avatar: Abdulaziz
    Abdulaziz
    Participant
    April 3, 2025 at 00:21

    Hello XStore Support Team,

    I hope this message finds you well.

    I’m currently customizing the registration process on my website ([your-website-url.com], e.g., abyatalamal.com) which uses the XStore theme and an XStore Child theme.

    I’ve added several custom fields (First Name, Last Name, Phone, Password Confirmation, Terms checkbox) to the WooCommerce registration form using code in my child theme’s functions.php file. I’ve also implemented custom validation rules and email verification successfully.

    However, I’ve encountered an issue with duplicate HTML element IDs on the default WooCommerce “My Account” page (/my-account/ or a similar slug) when a user is logged out. The browser console shows multiple errors like:

    [DOM] Found 2 elements with non-unique id #reg_billing_first_name: …
    [DOM] Found 2 elements with non-unique id #reg_password: …
    [DOM] Found 2 elements with non-unique id #reg_password_confirm: …
    [DOM] Found 2 elements with non-unique id #terms: …
    (and similar errors for other fields)

    This occurs because the default “My Account” page template seems to render both the standard Login form and the Registration form (with my custom fields included) within the main page content in addition to the Login/Register forms present in the theme’s built-in off-canvas panel / pop-up.

    Having duplicate IDs is causing issues, particularly preventing custom JavaScript (like a password strength indicator I added) from targeting the correct elements reliably.

    My Goal:

    I want to prevent the default Login and Registration forms from rendering within the main content of the “My Account” page when the user is logged out, and rely only on the theme’s off-canvas/pop-up forms for login and registration. This should resolve the duplicate ID issue.

    My Question:

    Is there a built-in theme option in XStore (Theme Options or Customizer) to disable the rendering of the default login/registration forms on the “My Account” page content for logged-out users?

    If not, what is the recommended method or hook/filter within the XStore framework to correctly remove or hide these default forms from the page content (specifically the forms rendered by woocommerce_account_content or the myaccount/form-login.php template for logged-out users), while ensuring the off-canvas/pop-up functionality remains intact?

    I have tried adding custom PHP code to functions.php using remove_action and filtering wc_get_template to prevent myaccount/form-login.php from loading, but I want to ensure I’m using the best practice compatible with XStore’s structure.

    Could you please provide guidance on the correct way to achieve this within the XStore theme?

    Thank you for your time and assistance!

    Best regards,

    Files is visible for topic creator and
    support staff only.
    5 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    April 3, 2025 at 12:43

    Dear @Abdulaziz,

    We hope this message finds you well.

    The duplication issue you are experiencing appears to be caused by the register/login form being loaded from the off-canvas section:

    https://tinyurl.com/22vuckfh

    If you would prefer to remove the default forms from the My Account page and display custom content instead (such as your own text), you may consider using the following code snippet:

    
    add_filter('the_content', 'n2t_my_account_override');
    function n2t_my_account_override($content) {
        if (!is_user_logged_in() && is_account_page()) {
            return 'Your Custom Text';
        }
        return $content;
    }
    

    We hope this solution proves helpful. Please feel free to reach out if you have any further questions or need additional assistance.

    Best regards,
    The 8Theme Team

    Avatar: Abdulaziz
    Abdulaziz
    Participant
    April 3, 2025 at 14:07

    How can I prevent the Off-Canvas login/register forms from loading or rendering specifically on the main /my-account/ page to avoid the duplicate ID issue? Is there a theme option or a different code snippet for this?

    Avatar: Justin
    Luca Rossi
    Support staff
    April 4, 2025 at 07:22

    Dear Abdulaziz,

    Please note that the login/register off-canvas is integrated with the header, and as such, it appears on all pages by default. Unfortunately, there is no custom code currently implemented to exclude it specifically from the “My Account” page.

    We appreciate your understanding.

    Best regards,
    The 8Theme Team

    Avatar: Abdulaziz
    Abdulaziz
    Participant
    April 4, 2025 at 16:33

    okay thank you

    Avatar: Tony Rodriguez
    Tony Rodriguez
    Support staff
    April 4, 2025 at 16:41

    Dear Abdulaziz,

    We hope you’re reveling in the experience our theme brings! Your enthusiasm is what fuels our passion. Would you be so kind as to channel that energy into a 5-star rating on ThemeForest? Your feedback is the spark that lights our way!

    Click here to spread the love: https://themeforest.net/downloads

    Thank you for being an integral part of our journey!

    Best Regards,
    The 8Theme Team

  • Viewing 6 results - 1 through 6 (of 6 total)

The issue related to '‘Duplicate IDs on My Account Page (Login/Register Forms)’' has been successfully resolved, and the topic is now closed for further responses

Helpful Topics

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.