Fix - Javascript show/hide of option in free shipping method.

This commit is contained in:
Mike Jolley 2016-06-21 10:47:19 +01:00
parent 9e574ab4d4
commit bc87f4a47e
2 changed files with 13 additions and 12 deletions

View File

@ -46,6 +46,18 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method {
* @return array * @return array
*/ */
public function get_instance_form_fields() { public function get_instance_form_fields() {
wc_enqueue_js( "
jQuery( function( $ ) {
$('#woocommerce_free_shipping_requires').change(function(){
if ( $(this).val() === 'coupon' || $(this).val() === '' ) {
$('#woocommerce_free_shipping_min_amount').closest('tr').hide();
} else {
$('#woocommerce_free_shipping_min_amount').closest('tr').show();
}
}).change();
});
" );
return array( return array(
'title' => array( 'title' => array(
'title' => __( 'Title', 'woocommerce' ), 'title' => __( 'Title', 'woocommerce' ),
@ -76,18 +88,6 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method {
'desc_tip' => true 'desc_tip' => true
) )
); );
wc_enqueue_js( "
jQuery( function( $ ) {
$('#woocommerce_free_shipping_requires').change(function(){
if ( $(this).val() === 'coupon' || $(this).val() === '' ) {
$('#woocommerce_free_shipping_min_amount').closest('tr').hide();
} else {
$('#woocommerce_free_shipping_min_amount').closest('tr').show();
}
}).change();
});
" );
} }
/** /**

View File

@ -167,6 +167,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Fix - wp_cache_flush after term meta migration/update. * Fix - wp_cache_flush after term meta migration/update.
* Fix - wc_add_to_cart_message() when non-array is passed. * Fix - wc_add_to_cart_message() when non-array is passed.
* Fix - woocommerce_redirect_single_search_result type check was incorrect. * Fix - woocommerce_redirect_single_search_result type check was incorrect.
* Fix - Javascript show/hide of option in free shipping method.
* Tweak - Made customer pay link display if order needs_payment() rather than checking pending status. * Tweak - Made customer pay link display if order needs_payment() rather than checking pending status.
* Tweak - Zones - Wording clarifications. * Tweak - Zones - Wording clarifications.
* Tweak - Zones - Match zones with postcodes but no country. * Tweak - Zones - Match zones with postcodes but no country.