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
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_instance_form_fields() {
|
public function get_instance_form_fields() {
|
||||||
|
if ( is_admin() ) {
|
||||||
wc_enqueue_js( "
|
wc_enqueue_js( "
|
||||||
jQuery( function( $ ) {
|
jQuery( function( $ ) {
|
||||||
function wcFreeShippingShowHideMinAmountField( el ) {
|
function wcFreeShippingShowHideMinAmountField( el ) {
|
||||||
|
@ -132,6 +133,7 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method {
|
||||||
} );
|
} );
|
||||||
});
|
});
|
||||||
" );
|
" );
|
||||||
|
}
|
||||||
|
|
||||||
return parent::get_instance_form_fields();
|
return parent::get_instance_form_fields();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue