0

i've been experiencing this error so far: the Add to Basket button is disabled for variable products on the English version of my wordpress website, when instead everything works on the Italian version. Altho a couple of errors from the debug I found out that the mistake is related to the below code got from Google Chrome which i have no clue how to fix or avoid..any help or hints would be really appreciated..

Uncaught TypeError: Cannot read property 'length' of null
    at e.isMatch (add-to-cart-variation.min.js?ver=2.6.12:1)
    at e.findMatchingVariations (add-to-cart-variation.min.js?ver=2.6.12:1)
    at HTMLSelectElement.<anonymous> (add-to-cart-variation.min.js?ver=2.6.12:1)
    at Function.each (jquery.js?ver=1.12.4:2)
    at a.fn.init.each (jquery.js?ver=1.12.4:2)
    at HTMLFormElement.e.onUpdateAttributes (add-to-cart-variation.min.js?ver=2.6.12:1)
    at HTMLFormElement.dispatch (jquery.js?ver=1.12.4:3)
    at HTMLFormElement.r.handle (jquery.js?ver=1.12.4:3)
    at Object.trigger (jquery.js?ver=1.12.4:3)
    at Object.a.event.trigger (jquery-migrate.min.js?ver=1.4.1:2)
e.isMatch @ add-to-cart-variation.min.js?ver=2.6.12:1
e.findMatchingVariations @ add-to-cart-variation.min.js?ver=2.6.12:1
(anonymous) @ add-to-cart-variation.min.js?ver=2.6.12:1
each @ jquery.js?ver=1.12.4:2
each @ jquery.js?ver=1.12.4:2
e.onUpdateAttributes @ add-to-cart-variation.min.js?ver=2.6.12:1
dispatch @ jquery.js?ver=1.12.4:3
r.handle @ jquery.js?ver=1.12.4:3
trigger @ jquery.js?ver=1.12.4:3
a.event.trigger @ jquery-migrate.min.js?ver=1.4.1:2
(anonymous) @ jquery.js?ver=1.12.4:3
each @ jquery.js?ver=1.12.4:2
each @ jquery.js?ver=1.12.4:2
trigger @ jquery.js?ver=1.12.4:3
e.onFindVariation @ add-to-cart-variation.min.js?ver=2.6.12:1
dispatch @ jquery.js?ver=1.12.4:3
r.handle @ jquery.js?ver=1.12.4:3
trigger @ jquery.js?ver=1.12.4:3
a.event.trigger @ jquery-migrate.min.js?ver=1.4.1:2
(anonymous) @ jquery.js?ver=1.12.4:3
each @ jquery.js?ver=1.12.4:2
each @ jquery.js?ver=1.12.4:2
trigger @ jquery.js?ver=1.12.4:3
e.onChange @ add-to-cart-variation.min.js?ver=2.6.12:1
dispatch @ jquery.js?ver=1.12.4:3
r.handle @ jquery.js?ver=1.12.4:3
caprica
  • 1
  • 2
  • Uncaught TypeError: Cannot read property 'length' of null at VariationForm.isMatch (add-to-cart-variation.js:453) at VariationForm.findMatchingVariations (add-to-cart-variation.js:436) at HTMLSelectElement. (add-to-cart-variation.js:325) at Function.each (jquery.js:2) at jQuery.fn.init.each (jquery.js:2) at HTMLFormElement.VariationForm.onUpdateAttributes (add-to-cart-variation.js:297)at HTMLFormElement.dispatch (jquery.js:3)at HTMLFormElement.r.handle (jquery.js:3)at Object.trigger (jquery.js:3)at Object.jQuery.event.trigger (jquery-migrate.js:633) – caprica Jan 17 '17 at 14:29
  • Apparently this is what is causing the errors/** * See if attributes match. * @return {Boolean} */ VariationForm.prototype.isMatch = function( variation_attributes, attributes ) { var match = true; for ( var attr_name in variation_attributes ) { if ( variation_attributes.hasOwnProperty( attr_name ) ) { var val1 = variation_attributes[ attr_name ]; var val2 = attributes[ attr_name ]; if ( val1 !== undefined && val2 !== undefined && val1.length !== 0 && val2.length !== 0 && val1 !== val2 ) { match = false; } } } return match; }; – caprica Jan 17 '17 at 14:48

0 Answers0