Woocommerce : jQuery cookie server responded with a status of 406

Recently I received error “406 Not Acceptable and server not responding” while working on a wordpress website with woocommerce plugin. This error comes on woocommerce website because of the outdated MOD_SECURITY core ruleset on some hosting accounts.

To solve this error you have to do following things on your wordpress website.

STEP 1 : Rename jquery.cookie.min.js file

You can find two jquery cookie files inside woocommerce plugin folder inside /assets/js/ folder

wp-content/plugins/woocommerce/assets/js/jquery-cookie/jquery.cookie.js
wp-content/plugins/woocommerce/assets/js/jquery-cookie/jquery.cookie.min.js

Rename two files To

wp-content/plugins/woocommerce/assets/js/jquery-cookie/jquery_cookie.js
wp-content/plugins/woocommerce/assets/js/jquery-cookie/jquery_cookie.min.js

STEP 2 : Add following code inside file functions.php of your active theme

add_action( 'wp_enqueue_scripts', 'custom_frontend_scripts' );function custom_frontend_scripts() {global $post, $woocommerce;

$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? : '.min';
wp_deregister_script( 'jquery-cookie' );
wp_register_script( 'jquery-cookie', $woocommerce->plugin_url() . '/assets/js/jquery-cookie/jquery_cookie' . $suffix . '.js', array( 'jquery' ), '1.3.1', true );

}

Make sure to add this code inside

Leave a Reply

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