Hello,
Customers must read and approve the membership agreement and privacy page when signing up. Isn’t this feature available in the Woodmart theme? How can we solve this without installing a plugin? When I asked Chat gpt, he said that we can solve the problem by adding the following code line to function.php. We kindly request your support on the relevant issue. This requested feature is mandatory all over the world for the privacy of membership records, we kindly ask you to consider it in the next development. I am sending a screenshot in the request attachment so that what I want can be understood.
Chat GPT’s Recommendation:
add_action(‘woocommerce_register_form’, ‘add_custom_terms_checkbox’);
function add_custom_terms_checkbox() {
?>
<p class=”form-row terms”>
<input type=”checkbox” class=”input-checkbox” name=”terms” id=”terms” />
<label for=”terms” class=”checkbox”><?php _e(‘I have read and agree to the terms and conditions‘, ‘woocommerce’); ?></label>
</p>
<?php
}
add_action(‘woocommerce_registration_errors’, ‘check_custom_terms_checkbox’, 10, 3);
function check_custom_terms_checkbox($errors, $username, $email) {
if ( ! isset($_POST[‘terms’]) ) {
$errors->add(‘terms_error’, __(‘You must agree to the terms and conditions.’, ‘woocommerce’));
}
return $errors;
}
Attachments:
You must be
logged in to view attached files.