diff --git a/_dev/js/product/index.js b/_dev/js/product/index.js index 01a3fc40..59a37d7c 100644 --- a/_dev/js/product/index.js +++ b/_dev/js/product/index.js @@ -5,6 +5,15 @@ function activateFirstProductTab() { $('.product-tabs .nav .nav-item:first-child a').tab('show'); } +function handleProductDetailsToggle() { + const $link = $('[href="#product-details"]'); + const $tab = $($link.attr('href')); + + if ($tab.length && $link.length && $link.hasClass('active')) { + $tab.addClass('show active'); + } +} + $(() => { activateFirstProductTab(); const gallery = new ProductGallery(); @@ -14,4 +23,8 @@ $(() => { prestashop.on('updatedProductCombination', () => { gallery.init(); }); + + prestashop.on('updatedProduct', () => { + handleProductDetailsToggle(); + }); });