Home Forums WoodMart support forum Check box privacy in registration page

Check box privacy in registration page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #344779

    manuel-logika
    Participant

    How to set the check box in page of registration?

    Attachments:
    You must be logged in to view attached files.
    #344867

    Luke Nielsen
    Keymaster

    Hello,

    At the moment you already have this check box (newsletter subscription checkbox).

    https://monosnap.com/file/zbp9Ik89hdrlp8mVBCXj9HZiZNWPw6

    Could you please clarify in more detail your issue? I will do my best to help you.

    Looking forward to hearing back from you!

    Kind Regards

    #344868

    manuel-logika
    Participant

    the newsletter subscription checkbox is automatic generated from plugin MC4WP (mailchimp). For privacy checkbox i don’t know how to integrate. can you help me?

    #345137

    Luke Nielsen
    Keymaster

    Hello,

    In order to show the “privacy policy” checkbox on the registration page, try to add this code to the functions.php file in your child theme.

    if ( ! function_exists('wd_add_registration_privacy_policy') ) {
        function wd_add_registration_privacy_policy() {
            woocommerce_form_field( 'privacy_policy_reg', array(
                'type'          => 'checkbox',
                'class'         => array('form-row privacy'),
                'label_class'   => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'),
                'input_class'   => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'),
                'required'      => true,
                'label'         => 'I\'ve read and accept the <a href="/privacy-policy">Privacy Policy</a>',
            ));
    
        }
        
        add_action( 'woocommerce_register_form', 'wd_add_registration_privacy_policy', 11 );
    }
    
    // Show error if user does not tick
    if ( ! function_exists('wd_validate_privacy_registration')) {
        function wd_validate_privacy_registration( $errors, $username, $email ) {
            if ( ! is_checkout() ) {
                if ( ! (int) isset( $_POST['privacy_policy_reg'] ) ) {
                    $errors->add( 'privacy_policy_reg_error', __( 'Privacy Policy consent is required!', 'woocommerce' ) );
                }
            }
            return $errors;
        }
    
        add_filter( 'woocommerce_registration_errors', 'wd_validate_privacy_registration', 10, 3 );
    }

    https://gyazo.com/a905abaea3d82bb34db03b0b616173a8

    Kind Regards

Viewing 4 posts - 1 through 4 (of 4 total)