Automattic\WooCommerce\Blocks\Domain\Services

CheckoutFields::update_default_locale_with_fields()publicWC 1.0

Update the default locale with additional fields without country limitations.

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

Хуков нет.

Возвращает

Разное.

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

$CheckoutFields = new CheckoutFields();
$CheckoutFields->update_default_locale_with_fields( $locale );
$locale(массив) (обязательный)
The locale to update.

Код CheckoutFields::update_default_locale_with_fields() WC 9.8.1

public function update_default_locale_with_fields( $locale ) {
	foreach ( $this->get_fields_for_location( 'address' ) as $field_key => $field ) {
		if ( empty( $locale[ $field_key ] ) ) {
			// If the field has conditional rules, we need to set the required property to false so it can be evaluated.
			if ( $this->is_conditional_field( $field_key ) ) {
				$field['required'] = false;
			}
			$locale[ $field_key ] = $field;
		}
	}
	return $locale;
}