Automattic\WooCommerce\StoreApi\Schemas\V1

CheckoutSchema::schema_has_required_propertyprotectedWC 1.0

Check if any additional field is required, so that the parent item is required as well.

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

Хуков нет.

Возвращает

true|false.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->schema_has_required_property( $additional_fields_schema );
$additional_fields_schema(массив) (обязательный)
Additional fields schema.

Код CheckoutSchema::schema_has_required_property() WC 10.0.2

protected function schema_has_required_property( $additional_fields_schema ) {
	return array_reduce(
		array_keys( $additional_fields_schema ),
		function ( $carry, $key ) use ( $additional_fields_schema ) {
			return $carry || true === $additional_fields_schema[ $key ]['required'];
		},
		false
	);
}