WC Tabs not working when url have query string (example google conversion-linker
-
When url have a query string (specifically, i have encounter this issue when the url contains Google Conversion linker tag (example: http://www.test.com/?gclid=12345) tabs stop working and a JQuery error appear (Uncaught Error: Syntax error, unrecognized expression)
the issue is in WooCommerce js file single-product.min.js where the anchor of the tab, if a query string exists, stops working.
I have changed these lines from:.on("click", ".wc-tabs li a, ul.tabs li a", function (t) { t.preventDefault(); var t = s(this), e = t.closest(".wc-tabs-wrapper, .woocommerce-tabs"); e.find(".wc-tabs, ul.tabs").find("li").removeClass("active"), e.find(".wc-tab, .panel:not(.panel .panel)").hide(), t.closest("li").addClass("active"), e.find(t.attr("href")).show(); })To
.on("click", ".wc-tabs li a, ul.tabs li a", function (t) { t.preventDefault(); var t = s(this), e = t.closest(".wc-tabs-wrapper, .woocommerce-tabs"); var u = t.attr("href"); var h = u.split('#').pop(); var n = "#" + h; e.find(".wc-tabs, ul.tabs").find("li").removeClass("active"), e.find(".wc-tab, .panel:not(.panel .panel)").hide(), t.closest("li").addClass("active"), e.find(n).show(); })basically i’ m removing the query string and re-create the href without that. It work, but obviously i have modified a woocommerce file that will be override when new updates come, what is the best way to report this issue? i also tried to dequeue the single-product.min.js file (work) but when i load my js file, it do not work.
this happen on storefront, and also on other themes.
the issue appeared here too, but it was closed:https://github.com/woocommerce/woocommerce/issues/33637
i can create a sandbox to replicate if needed.
many thanks
The topic ‘WC Tabs not working when url have query string (example google conversion-linker’ is closed to new replies.