We were in a dilemma with a recent problem with Gravity Forms and WooCommerce. One of our clients sells memberships online. He takes membership information with a Gravity Form when selling the membership. Our client was using Gravity Forms, WooCommerce and WooCommerce Gravity Forms Product Add-Ons – together to sell this membership.
Suddenly, an update to WooCommerce to latest version 3.3.3 surprisingly broke the system. After the update, it was raising a mysterious cart-fragments.js error and the GForm fields disappeared from the registration page.
JS Error in text:
Uncaught TypeError: Cannot read property 'toString' of undefined
at HTMLDocument. (cart-fragments.js?ver=3.3.3:39)
at i (jquery.js?ver=1.12.4:2)
at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
at Function.ready (jquery.js?ver=1.12.4:2)
at HTMLDocument.K (jquery.js?ver=1.12.4:2)
That’s not all. There were some required fields, and as the fields could not be filled, due to being invisible, it was stopping the user from adding it to cart – causing a total broken system.
We dived into the problem right after getting the feedback. After a bit of looking, we found out that others faced the similar issue. The problem was fixed when WooCommerce was downgraded to 3.2.6. Thought of the moment was that the issue was with WooCommerce, so we went on to post a bug to WooCommerce about the issue. Good folks from there suggested there must be something else that may be causing this, because other plugins or some unknown code may influence how cart-fragments work.
To find a solution, first we changed to Storefront theme, but no use. So the problem was not there on the theme. Then we ran an extensive trial and error test and at the end we found out that an unsupported and old plugin named “Woocommerce Poor Guys Swiss Knife” was responsible for the issue. We Deactivated the plugin and the issue was gone.
If you face the error, we would suggest you do the following:
- Take a backup
- Setup a staging or local as a copy of live site
- On the copy, Deactivate all the plugins (keep only GF and WC if possible) and see if the issue fixes
- If yes, then gradually Activate the plugins one by one to narrow it down to the problem plugin
- You can also check on your theme functions.php to see if anything is causing the issue
- Also, debug.log is your friend
The solution was easy but we had to do some grinding to get to the solution.
But we still love it when it gets solved! Nothing like a solved mystery!