Override BTW-number validation
-
One one of my sites we have a button to comply with a regulation of 0% if you’re eligble. For this we have a checkbox function that sets the set_is_vat_exempt( true ) value when the radio is selected.
When we have this plugin active our implementation is not working. How can we allow our module to override the settings of the euvat plugin so even though the BTW is valid/not valid the btw will be 0%
add_action( 'woocommerce_cart_calculate_fees', 'hex_checkout_radio_choice_fee', 20, 1 );
function hex_checkout_radio_choice_fee( $cart ) {
parse_str (WC()->checkout()->get_value('post_data'),$post_data);
$selected_radio=$post_data['radio_choice'];
WC()->customer->set_is_vat_exempt( false );
$radio = WC()->checkout->get_value( 'radio_choice' ) ;
if ( $selected_radio) {
WC()->customer->set_is_vat_exempt( true );
}
}
add_action( 'woocommerce_checkout_update_order_review', 'hex_checkout_radio_choice_set_session' );
function hex_checkout_radio_choice_set_session( $posted_data ) {
parse_str( $posted_data, $output );
if ( $output['radio_choice'] == 1 ){
WC()->session->set( 'radio_chosen', $output['radio_choice'] );
WC()->customer->set_is_vat_exempt( true );
}else {
WC()->customer->set_is_vat_exempt( false );
}
}
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Override BTW-number validation’ is closed to new replies.