Does anybody know find out how to cease the transition to the checkout web page after one clicks “proceed to checkout” on the cart web page? I carried out a validation on the checkout web page that labored completely with wc_add_notice(“Some message right here”). Nevertheless, when I attempt to do the identical proccess on the cart web page, I’m taken to the checkout web page with the error message. I even tried redirecting customers with the header(), however nonetheless get taken to the checkout web page regardless.
Right here is my code:
add_action('woocommerce_proceed_to_checkout', 'username_check');
perform username_check() {
if ( ! $_POST['username_value'] ) {
wc_add_notice( __( 'Enter your appropriate username' ), 'error' );
}
if ( ! $_POST['password_value'] ) {
wc_add_notice( __( 'Enter your appropriate password' ), 'error' );
}
}