Javascript error when using multiple forms on a WooCommerce product list page

This is a bit long-haired, and I’m not entirely sure whether this is a GF error or a GF with WooCommerce error - but here goes: :slight_smile:

I’m creating a product list page where each product has it’s own GF. So far so good - they all show up, and everything actually works fine, but the Total amount calculation script throws an error:

In this script (added by GF/Woo I think):
gform.addFilter(‘gform_product_total’, function(total, formId) {
const product_id = jQuery(“input[name=product_id]”).val();

            if (wc_gravityforms_params.use_ajax[product_id]) {
                return update_dynamic_price_ajax(total, formId);
            } else {
                return update_dynamic_price(total, formId);
            }
        });

The error
Uncaught ReferenceError: wc_gravityforms_params is not defined
Is thrown on the line
if (wc_gravityforms_params.use_ajax[product_id]) {

I suspect it has something to do with there being 3 of them on the page (as it’s a product list), since if you go to the individual product it doesn’t have the error.

Everything works fine - can add each product from the list directly to the cart (and thus skipping the product page) - but the JS error bugs me (!).

I can provide the page as example in a PM - but not posting it here, as it’s a development site not for public consumption… :stuck_out_tongue:

© 2008 - 2019. Gravity Forms is a project by Rocketgenius Inc.