/*
Theme Name: Enfold Child
Description: A <a href='http://codex.wordpress.org/Child_Themes'>Child Theme</a> for the Enfold Wordpress Theme. If you plan to do a lot of file modifications we recommend to use this Theme instead of the original Theme. Updating will be much easier then.
Version: 1.0
Author: Kriesi
Author URI: http://www.kriesi.at
Template: enfold
*/



/*Add your own styles here:*/

// Toon geselecteerde maat onder de producttitel
add_action('woocommerce_single_product_summary', 'toon_geselecteerde_maat_html', 6);
function toon_geselecteerde_maat_html() {
    echo '<div id="selected-maat-display" style="font-weight:bold; margin-bottom:10px;"></div>';
}
// Voeg custom JS toe voor variabele maatselectie
add_action('wp_footer', 'custom_variation_script');
function custom_variation_script() {
    if (is_product()) : ?>
        <script>
        jQuery(document).ready(function($){
            $('.variations_form').on('woocommerce_variation_has_changed', function () {
                let selectedMaat = $('select[name="attribute_pa_maat"]').val();
                if(selectedMaat){
                    $('#selected-maat-display').text('Geselecteerde maat: ' + selectedMaat);
                } else {
                    $('#selected-maat-display').text('');
                }
            });
        });
        </script>
    <?php
    endif;
}
