Automattic\WooCommerce\Internal\ProductCustoms

CustomsDataValidator::normalize_stored_value │ public static │ WC 11.3.0

Lightly normalizes a stored customs value read from the database, without validating it.

Метод класса: CustomsDataValidator{}

Хуков нет.

Возвращает

string|null.

Использование

$result = CustomsDataValidator::normalize_stored_value( $prop, $value ): ?string;
$prop(строка) (обязательный)
Customs prop name, such as customs_country_of_origin.
$value(разное) (обязательный)
Stored value.

Список изменений

С версии 11.3.0 Введена.

Код CustomsDataValidator::normalize_stored_value() 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;
}