Skip to content

Instantly share code, notes, and snippets.

@rynaldos-zz
Last active December 14, 2020 17:37
Show Gist options
  • Save rynaldos-zz/4993f8515580601856d51fccf974f8de to your computer and use it in GitHub Desktop.
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
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)
@damadorPL
Copy link

@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