functions.php not work
-
Hello,
PHP code does not works. I have added it to the functions.php file.
I would like to add an extra “Privacy policy” checkbox for my webshop’s checkout page.
After, I’ve added the code, it is become visible on the top of the checkout page.
The code is:
add_action( ‘woocommerce_review_order_before_submit’, ‘add_privacy_checkbox’, 9 );
function add_privacy_checkbox() {
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’ => ‘I\’ve read and accept the Privacy Policy‘,
));
}
add_action( ‘woocommerce_checkout_process’, ‘privacy_checkbox_error_message’ );
function privacy_checkbox_error_message() {
if ( ! (int) isset( $_POST[‘privacy_policy’] ) ) {
wc_add_notice( __( ‘You have to agree to our privacy policy in order to proceed’ ), ‘error’ );
}
}Thank you for the help in advance!
Regards,
Janos
The page I need help with: [log in to see the link]
- The topic ‘functions.php not work’ is closed to new replies.