Title: Javascript Error in WooCommerce Admin
Last modified: January 30, 2019

---

# Javascript Error in WooCommerce Admin

 *  Resolved [Fencer04](https://wordpress.org/support/users/fencer04/)
 * (@fencer04)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/javascript-error-in-woocommerce-admin/)
 * I want to alert you to an error that is caused in the javascript admin when this
   plugin is active. The site is using WordPress 5.0.3 and WooCommerce 3.5.4. Both
   are the latest versions as of this post. When you try and access the variations
   of a product on the product admin page the are not displayed and there is the
   following javascript error:
 *     ```
       Uncaught TypeError: Cannot read property 'replace' of undefined
           at CMB2ConditionalsFindDependants (cmb2-conditionals.js?ver=1.0.4:formatted:209)
           at HTMLSelectElement.<anonymous> (cmb2-conditionals.js?ver=1.0.4:formatted:41)
           at HTMLFormElement.dispatch (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:3)
           at HTMLFormElement.r.handle (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:3)
           at Object.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:3)
           at Object.a.event.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:9)
           at HTMLSelectElement.<anonymous> (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:3)
           at Function.each (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:2)
           at a.fn.init.each (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:2)
           at a.fn.init.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,utils&ver=0ab618a0c7f727035c000c0a569dc7a9:3)
       ```
   
 * I was able to resolve this by editing the plugin function CMB2ConditionalsFindDependants
   in file /includes/CMB2-conditionals/cmb2-conditionals.js to:
 *     ```
       function CMB2ConditionalsFindDependants( fieldName, elm, context ) {
       	var inGroup, iterator;
   
       	var dependants = [];
   
       	if( typeof( fileName ) != "undefined" ) {
       		// Remove the empty [] at the end of a multi-check field.
       		fieldName = fieldName.replace( /\[\]$/, '' );
   
       		// Is there an element which is conditional on this element ?
       		// If a group element, within the group.
       		inGroup = elm.closest( '.cmb-repeatable-grouping' );
       		if ( 1 === inGroup.length ) {
       			iterator = elm.closest( '[data-iterator]' ).data( 'iterator' );
       			dependants = $( '[data-conditional-id]', inGroup ).filter( function() {
       				var conditionalId = $( this ).data( 'conditional-id' );
       				return ( Array.isArray( conditionalId ) && ( fieldName === conditionalId[0] + '[' + iterator + '][' + conditionalId[1] + ']' ) );
       			});
       		}
   
       		// Else within the whole form.
       		else {
       			dependants = $( '[data-conditional-id="' + fieldName + '"]', context );
       		}
       	}
       	return dependants;
       }
       ```
   

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [cornershop](https://wordpress.org/support/users/cornershop/)
 * (@cornershop)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/javascript-error-in-woocommerce-admin/#post-11159374)
 * Thanks for this heads up [@fencer04](https://wordpress.org/support/users/fencer04/)!
   I’m having our devs take a look at what you’ve provided to see if we can fix 
   this for all users.
 * If there’s anything else you need, please don’t hesitate to let us know here 
   or by emailing [support@cshp.co](https://wordpress.org/support/topic/javascript-error-in-woocommerce-admin/support@cshp.co?output_format=md)
 * Best,
    Monica
 *  Plugin Support [cornershop](https://wordpress.org/support/users/cornershop/)
 * (@cornershop)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/javascript-error-in-woocommerce-admin/#post-11171797)
 * Thanks again for bringing this to our attention [@fencer04](https://wordpress.org/support/users/fencer04/)!
   We’re incorporating a resolution into our new version of this plugin, which will
   be called WP Popup and will be released shortly!
 * We really appreciate that you took the time to bring out attention to this.
 *  Thread Starter [Fencer04](https://wordpress.org/support/users/fencer04/)
 * (@fencer04)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/javascript-error-in-woocommerce-admin/#post-11171965)
 * So if I update to the latest version of this plugin will it revert back to having
   the error or has this been fixed? The only thing I see in the changelog is ad
   admin notice about the new plugin.
 *  Plugin Support [cornershop](https://wordpress.org/support/users/cornershop/)
 * (@cornershop)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/javascript-error-in-woocommerce-admin/#post-11185497)
 * Unfortunately, it’ll revert to having the error if you update. We’re fixing it
   on the new plugin since we’re moving away from this one.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Javascript Error in WooCommerce Admin’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/smart-overlay_3ca7be.svg)
 * [Smart Overlay](https://wordpress.org/plugins/smart-overlay/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/smart-overlay/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/smart-overlay/)
 * [Active Topics](https://wordpress.org/support/plugin/smart-overlay/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/smart-overlay/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/smart-overlay/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [cornershop](https://wordpress.org/support/users/cornershop/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/javascript-error-in-woocommerce-admin/#post-11185497)
 * Status: resolved