Problem: The jQuery code doesn't triggers "update_checkout".
I have added a custom select field on order review table for customers to choose the tip amount as shown:
I want to trigger update_checkout when then select value changes, but it doesn't happen. If I select the shipping method it does triggers "update_checkout" and updates the amount percentage correctly.
HTML:
<tr class="propina">
<th id="propina_field">Propina</th>
<td>
<span class="woocommerce-input-wrapper">
<select name="propina" id="propina" class="select" data-placeholder="">
<option value="0">0</option>
<option value="1">1%</option>
<option value="2">2%</option>
<option value="3">3%</option>
<option value="5">5%</option>
<option value="7">7%</option>
<option selected value="10">10%</option>
</select>
</span>
</td>
</tr>
functions.php:
add_action( 'wp_head', 'woocommerce_tip' );
function woocommerce_tip() {
?>
<script type="text/javascript">
jQuery( document ).ready(function( $ ) {
$('#propina').change(function(){
jQuery('body').trigger('update_checkout');
});
});
</script>
<?php
}