Disable the WooCommerce terms and conditions link toggle and force it to open in a new tab

The following function will disable the WooCommerce terms and conditions link toggle feature and force the terms page to open in a new tab.

add_action( 'wp_enqueue_scripts', 'disable_wc_terms_toggle', 1000 );

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' ); } );" );
}


Was this helpful? Please buy me a coffee






This code should be added to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update.

2 thoughts on “Disable the WooCommerce terms and conditions link toggle and force it to open in a new tab

  1. Sorry to say that, but this code doesn’t work anymore.

    You have to add the following snippet to archieve the desired result:

    function disable_wc_terms_toggle() {
    wp_add_inline_script( ‘wc-checkout’, “jQuery( document ).ready( function() { jQuery( document.body ).off( ‘click’, ‘a.woocommerce-terms-and-conditions-link’ ); } );” );
    }

    1. The code still works — tested on a clean install using WooCommerce core v3.4.5 and Storefront theme v3.3.3

      Your code is, however, giving a syntax error, unexpected 'and' (T_LOGICAL_AND)

Share your thoughts

Your email address will not be published. Required fields are marked *