Only print js for free shipping fields in admin
Since WC_Shipping_Method->get_option() runs $this->get_instance_form_fields it prints out the JS even when getting the option outsite admin.
This commit is contained in:
parent
500c68d729
commit
58eaa70424
|
@ -107,6 +107,7 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method {
|
|||
* @return array
|
||||
*/
|
||||
public function get_instance_form_fields() {
|
||||
if ( is_admin() ) {
|
||||
wc_enqueue_js( "
|
||||
jQuery( function( $ ) {
|
||||
function wcFreeShippingShowHideMinAmountField( el ) {
|
||||
|
@ -132,6 +133,7 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method {
|
|||
} );
|
||||
});
|
||||
" );
|
||||
}
|
||||
|
||||
return parent::get_instance_form_fields();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue