Created
March 12, 2020 14:27
-
-
Save pavr0m/a002ce2b5448efad22421ba723664181 to your computer and use it in GitHub Desktop.
WooCommerce. Checkout - prevent scroll to notices.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_footer','woo_checkout_prevent_scroll_to_notices' ); | |
function woo_checkout_prevent_scroll_to_notices() { | |
if ( function_exists( 'is_checkout' ) && is_checkout() ) : | |
ob_start();?> | |
<script> | |
jQuery( function($) { | |
$( document ).ajaxComplete( function() { // prevents woocommerce checkout.js scroll to notices on ajax update | |
$( 'html, body' ).stop(); | |
} | |
}); // jquery wrap | |
</script> | |
<?php | |
ob_end_flush(); | |
endif; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment