Automattic\WooCommerce\Internal\ProductCustoms
CustomsDataValidator::normalize_stored_value
Lightly normalizes a stored customs value read from the database, without validating it.
Method of the class: CustomsDataValidator{}
No Hooks.
Returns
string|null.
Usage
$result = CustomsDataValidator::normalize_stored_value( $prop, $value ): ?string;
- $prop(string) (required)
- Customs prop name, such as customs_country_of_origin.
- $value(mixed) (required)
- Stored value.
Changelog
| Since 11.3.0 | Introduced. |
CustomsDataValidator::normalize_stored_value() CustomsDataValidator::normalize stored value code WC 11.3.0
public static function normalize_stored_value( string $prop, $value ): ?string {
if ( ! is_string( $value ) ) {
return null;
}
$value = trim( $value );
if ( '' === $value ) {
return null;
}
return 'customs_country_of_origin' === $prop ? strtoupper( $value ) : $value;
}