/*
Theme Name:           Flatsome
Theme URI:            http://flatsome.uxthemes.com
Author:               UX-Themes
Author URI:           https://uxthemes.com
Description:          Multi-Purpose Responsive WooCommerce Theme
Version:              3.20.5
Requires at least:    6.4
Requires PHP:         7.4
WC requires at least: 8.3
Text Domain:          flatsome
License:              https://themeforest.net/licenses
License URI:          https://themeforest.net/licenses
*/


/***************
All custom CSS should be added to Flatsome > Advanced > Custom CSS,
or in the style.css of a Child Theme.
***************/
add_action('wp_footer', function () {
    if (is_product()) {
        ?>
        <script>
        document.addEventListener("DOMContentLoaded", function() {
          const link = document.querySelector(".detail-link");

          if(link){
            link.addEventListener("click", function(e){
              e.preventDefault();

              const tabLink = document.querySelector('a[href="#tab-paytr_taksit"]');
              if(tabLink){
                tabLink.click();
                tabLink.scrollIntoView({ behavior: "smooth", block: "start" });
              }
            });
          }
        });
        </script>
        <?php
    }
});