diff --git a/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php b/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php index ed4984c1c64..e1c3e748623 100644 --- a/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php +++ b/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php @@ -46,6 +46,18 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method { * @return array */ 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( 'title' => array( 'title' => __( 'Title', 'woocommerce' ), @@ -76,18 +88,6 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method { '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(); - }); - " ); } /** diff --git a/readme.txt b/readme.txt index 75a4c789bb2..3f211a9fee1 100644 --- a/readme.txt +++ b/readme.txt @@ -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 - wc_add_to_cart_message() when non-array is passed. * 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 - Zones - Wording clarifications. * Tweak - Zones - Match zones with postcodes but no country.