Customize Sign In Register DropDown Form

This topic has 7 replies, 3 voices, and was last updated 1 years, 3 months ago ago by Mineraland

  • 6 Answers
    Avatar: Mineraland
    Mineraland
    Participant
    January 6, 2023 at 17:00

    Image

    Avatar: Tony Rodriguez
    Tony Rodriguez
    Support staff
    January 7, 2023 at 10:31

    Hello, @Mineraland,

    1. Please let me know how you did that on the registration page? Basically the registration page is the WooCommerce default functionality and the Popup of the Login/Registration is our theme functionality but we have used the hook to show the default WooCommerce Login/Registration to that Popup, So if you add any checkbox using the custom code or the third party plugin on my account page then you have to do it manually also in the popup as well, as there is no such option to add that code or checkbox in my account popup in our theme.

    2. You’ll be able to translate the mentioned things using a WPML string translator: https://prnt.sc/pd8y21
    Go to WPML > String translator > scroll down to the “Admin strings” link and click on this. Find the mentioned strings and add then to the string translator.

    Regards 8Themes Team.

    Avatar: Mineraland
    Mineraland
    Participant
    January 7, 2023 at 15:53

    I added the following code in Apperance>Theme File Editor>Functions.php:

    I did that according to a guide (I’m not a PHP developer) and it works. Can we add the same code to the popups? If yes how? I need your support there. Thanks in advance

    // Add term and conditions check box on registration form
    add_action( 'woocommerce_register_form', 'njengah_terms_and_conditions_to_registration', 20 );
    function njengah_terms_and_conditions_to_registration() {
        if ( wc_get_page_id( 'terms' ) > 0 && is_account_page() ) {
            ?>
            <p class="form-row terms wc-terms-and-conditions">
                <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
                    <input type="checkbox" class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" name="terms" <?php checked( apply_filters( 'woocommerce_terms_is_checked_default', isset( $_POST['terms'] ) ), true ); ?> id="terms" /> <span><?php printf( __( 'I&rsquo;ve read and accept the <a href="%s" target="_blank" class="woocommerce-terms-and-conditions-link">terms & conditions</a>', 'woocommerce' ), esc_url( wc_get_page_permalink( 'terms' ) ) ); ?></span> <span class="required">*</span>
                </label>
    
      <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
                    <input type="checkbox" class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" name="privacy-policy" <?php checked( apply_filters( 'woocommerce_terms_is_checked_default', isset( $_POST['privacy-policy'] ) ), true ); ?> id="privacy-policy" /> <span><?php printf( __( 'I&rsquo;ve read and accept the <a href="https://mineraland.shop/privacy-policy/">Privacy Policy</a>', 'woocommerce' ), esc_url( wc_get_page_permalink( 'privacy-policy' ) ) ); ?></span> <span class="required">*</span>
                </label>
    
                <input type="hidden" name="terms-field" value="1" />
            </p>
        <?php
        }
    }
    // Validate required term and conditions check box
    add_action( 'woocommerce_register_post', 'terms_and_conditions_validation', 20, 3 );
    function terms_and_conditions_validation( $username, $email, $validation_errors ) {
        if ( ! isset( $_POST['terms'] ) )
            $validation_errors->add( 'terms_error', __( 'Terms and condition are not checked!', 'woocommerce' ) );
        return $validation_errors;
    }
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    January 8, 2023 at 13:28

    Hello,

    Please try to choose the Privacy policy page in Customizer > WooCommerce > Checkout settings https://prnt.sc/11t4sdi > https://gyazo.com/a3ddc0f1ad5eecc1966d27cceaf586f3
    Sorry, but additional customization in files is outside the scope of our basic support.
    About translation, mentioned strings come from XStore Core plugin, you can use WPML to translate them.

    Regards

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    January 9, 2023 at 08:18

    We checked your custom code in deep detail and found that your function has a condition of checking if it is an account page -> https://prnt.sc/d1waBYEtcbnZ . It means that your code will work only in case customer is on the account page. If you want to do it for off-canvas also, please, try to remove the selected string and leave only the condition of if ( wc_get_page_id( ‘terms’ ) > 0 ) instead of if ( wc_get_page_id( ‘terms’ ) > 0 && is_account_page() )

    Regards

    Avatar: Mineraland
    Mineraland
    Participant
    January 9, 2023 at 20:38

    Nice, thank you for the tip

    checkbox

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

The issue related to '‘Customize Sign In Register DropDown Form’' has been successfully resolved, and the topic is now closed for further responses

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