This topic has 7 replies, 3 voices, and was last updated 1 years, 3 months ago ago by Mineraland
Due to EU regulations, the terms and data protection must be accepted with a checkbox when registering. I did that on the registration page. Unfortunately, I can’t do that with the dropdown form. I haven’t found any information about this. Can you help me?
Second question would be if I can translate the dropdown menu for login and registration with WPML? Or is that only possible with Loco Translate?
Regards
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.
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’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’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;
}
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
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
Nice, thank you for the tip
The issue related to '‘Customize Sign In Register DropDown Form’' has been successfully resolved, and the topic is now closed for further responses