I would like to implement a checkbox icon, in the same way as the Botiga theme.
I’ve added a code snippet, and an additional checkbox "Policy terms" appears.
But I can’t figure out about the CSS, the checkbox is not visible.
I think the problem is here:
<input type="checkbox" class="input-checkbox woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" name="privacy_policy" id="privacy_policy" value="1">
And it should be:
<input type="checkbox" class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" name="privacy_policy" id="privacy_policy" value="1">
I don't know how to remove "input-checkbox" value class attribute.
Here is my code snippet:
add_action( 'woocommerce_checkout_after_terms_and_conditions', 'add_privacy_block', 9 );
function add_privacy_block() {
woocommerce_form_field( 'privacy_policy', 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' => 'Я прочитал и согласен с <a href="https://genreeds.ru/politic-conf/"><b>политикой конфиденциальности</b></a>',
));
}
add_action( 'woocommerce_checkout_process', 'privacy_checkbox_error_message' );
function privacy_checkbox_error_message() {
if ( ! (int) isset( $_POST['privacy_policy'] ) ) {
wc_add_notice( __( 'Вам необходимо отметить галочкой, что вы ознакомлены с политикой конфиденциальности' ), 'error' );
}
}
Here is the linked page with this issue.
I can make a standard checkbox, but then I need to change the checkbox that comes with the theme above.
Probably easier to achieve that if that additional checkbox with the "botiga" is displayed?
I think the solution is very simple, but I don't have enough knowledge. Any help is appreciated.
Update:
Variant 1
If I add "label_class_disabled" to the snippet, then the checkbox appears. But he has a different design, standard.
Variant 2
Code the Policy checkbox
And here is how the checkbox code looks like that WORKS



