'How do I disable wc-cart-fragments without console error?

I have a client who does merchandise 'drops' where they receive a lot of traffic. In order to limit some of the excess load on the server I am disabling AJAX wc-cart-fragments using this code on the home page:

/** Disable wc-cart-fragments from WooCommerce */
add_action( 'wp_enqueue_scripts', 'dequeue_woocommerce_cart_fragments', 11); 
function dequeue_woocommerce_cart_fragments() {
    if (is_front_page()) wp_dequeue_script('wc-cart-fragments');
}

This works but it's generating this error in console:

Uncaught ReferenceError: wc_cart_fragments_params is not defined
    at v (main.min.js:34:29419)
    at HTMLDocument.<anonymous> (main.min.js:34:30106)
    at e (jquery.min.js:2:30038)
    at t (jquery.min.js:2:30340)

Which is originating from jQuery. Obviously I don't want to be editing the jQuery library in order to prevent this error, so I'm wondering if there is a way to modify the above PHP or to add in a separate piece of code that will clear this error from Console?

Any ideas on how this can be achieved would be greatly appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source