WC_Settings_API::validate_price_field
Validate Price Field.
Make sure the data is escaped correctly, etc.
Method of the class: WC_Settings_API{}
No Hooks.
Returns
String.
Usage
$WC_Settings_API = new WC_Settings_API(); $WC_Settings_API->validate_price_field( $key, $value );
- $key(string) (required)
- Field key.
- $value(string) (required)
- Posted Value.
WC_Settings_API::validate_price_field() WC Settings API::validate price field code WC 10.5.0
public function validate_price_field( $key, $value ) {
$value = is_null( $value ) ? '' : $value;
return ( '' === $value ) ? '' : wc_format_decimal( trim( stripslashes( $value ) ) );
}