Thank you for reaching out and reporting this issue!
Could you share a link to the page with this error?
Hello @pistachio6321
I just patched it in our client’s child theme using the following code:
function load_colcade_for_reviews_plugin() {
wp_enqueue_script(
'colcade',
'https://unpkg.com/colcade@0/colcade.js',
array(),
null,
true
);
}
add_action('wp_enqueue_scripts', 'load_colcade_for_reviews_plugin', 5);
It was causing a conflict with Google Recaptcha and preventing forms from submitting, so we needed to patch it quickly.
Here is a summary:
Problem Details:
- The plugin’s frontend JavaScript calls
Colcade.makeJQueryPlugin() without first checking if the Colcade library is loaded.
- This happens even on pages where there are no review grids or no shortcodes present.
- As a result, this breaks JavaScript execution globally, even on non-product pages like the homepage, cart, checkout, etc.
Root Cause:
- The plugin’s JavaScript file assumes that
Colcade will always be available.
- However,
Colcade is only needed when a review grid (e.g., [cusrev_reviews_grid] shortcode) is actually displayed.
- No conditional loading or existence check is done before calling Colcade methods.
Temporary Workaround:
- To prevent JS errors and broken functionality, we had to manually enqueue the Colcade library sitewide via our child theme’s
functions.php.
- However, this is not ideal because it loads an unnecessary asset on every page, negatively impacting performance.
Recommended Fix:
- Before calling
Colcade.makeJQueryPlugin(), the plugin should first:
- Check if
Colcade is defined (if ( typeof Colcade !== "undefined" )).
- Only attempt to initialize Colcade when there is a
.cr-reviews-grid-inner element present in the DOM.
- Alternatively, conditionally load Colcade only on pages where it is actually needed (where the shortcode or widget is used).
This would ensure better performance, avoid unnecessary errors, and reduce resource loading on unrelated pages.
Thanks
Thank you for sharing the additional details. This issue should be resolved in the version 5.76.2. Please install the update and let us know in case of any further issues.
@pistachio6321 –
Thank you for your quick response and attention to this issue, we have updated our client’s site and the new version does resolve this particular issue.
Have a great day!