Last active
December 14, 2020 17:37
-
-
Save rynaldos-zz/4993f8515580601856d51fccf974f8de to your computer and use it in GitHub Desktop.
[WooCommerce 3.0+] Disable terms and conditions toggle and force it to open in a new tab
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
function disable_wc_terms_toggle() { | |
wp_enqueue_script( 'disable-terms-toggle', '/disable-terms-toggle.js', array( 'wc-checkout', 'jquery' ), null, true ); | |
wp_add_inline_script( 'disable-terms-toggle', "jQuery( document ).ready( function() { jQuery( document.body ).off( 'click', 'a.woocommerce-terms-and-conditions-link' ); } );" ); | |
} | |
add_action( 'wp_enqueue_scripts', 'disable_wc_terms_toggle', 1000 ); | |
// This snippet can be used alongside https://gist.github.com/rynaldos/0bee7d84a83c5b52096c747c19d088c0 (custom terms and conditions link) |
@bjornweb what folder do you put this function in?
@bjornweb what folder do you put this function in?
usually functions php - best in child theme :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prefect @bjornweb just what I needed :)