1. Documentation /
  2. jQuery.cookie.js/jQuery.cookie.min.js scripts fail to load

jQuery.cookie.js/jQuery.cookie.min.js scripts fail to load

This is a problem with the server-setting, meaning that your hosting company will need to solve this on your behalf. The problem is outdated MOD_SECURITY core ruleset.

Option 1: Get your host to update the rule set

↑ Torna in cima

This is by far the best option as everything will then work as by design. Contact your hosting provider for assistance.

Option 2: Rename files and update functions.php

This option only works with WooCommerce 2.6.14 or below. If you are running WooCommerce 3.0.0 or above, please refer to Option 1 or 3.

Alternatively, you’ll need to change how WooCommerce handles the files. This change will need to be repeated whenever you update the WooCommerce plugin as the changes will be overwritten.

Rename these files:

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

to:

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

And add the following to your theme’s functions.php file:

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

Option 3: use a plugin to rename the files

↑ Torna in cima

If the first two options aren’t possible, then you can use a plugin, which renames the file being loaded:

Note: Please remove any previous fixes you may have applied.

Questions and Support

↑ Torna in cima

Do you still have questions and need assistance? 

This documentation is about the free, core WooCommerce plugin for which support is provided in our community forums on WordPress.org. Searching there you’ll often find that your question has been asked and answered before.

If you haven’t created a WordPress.org account to use the forums, here’s how.

  • If you’re looking to extend the core functionality shown here, we recommend reviewing available extensions in the Woo Marketplace.
  • Need ongoing advanced support, or a customization built for WooCommerce? Hire a WooExpert agency.
  • Are you a developer building your own WooCommerce integration or extension? Check our Developer Resources.

If you weren’t able to find the information you need, please use the feedback thumbs below to let us know! 🙏