I am using WooCommerce and the Flatsome template. I need to show the price of the variation inside the attribute button, even when the variation is not selected. This is the code I am using (taken from ChatGPT) but as you can see here: https://qualterradev.wpengine.com/product/ag-biochar-version-1-2/ is not working very well. Thanks
<script>
jQuery(document).ready(function($) {
jQuery('.variations_form').on('woocommerce_variation_select_change', function() {
var variationPrice = $('.single_variation .woocommerce-variation-price .price').html(); // Obtener el precio de la variación seleccionada
jQuery('.variations .ux-swatch').each(function() {
jQuery(this).append('<span class="variation-price">' + variationPrice + '</span>'); // Agregar el precio como un span dentro del botón
});
});
});
</script>