WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Countries::get_default_address_fields() public WC 1.0

Returns the fields we show by default. This can be filtered later on.

Это метод класса: WC_Countries{}

Хуки из метода
Возвращает

Массив.

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

$WC_Countries = new WC_Countries();
$WC_Countries->get_default_address_fields();

Код WC Countries::get default address fields: woocommerce/includes/class-wc-countries.php WC 4.5.2

<?php
public function get_default_address_fields() {
	if ( 'optional' === get_option( 'woocommerce_checkout_address_2_field', 'optional' ) ) {
		$address_2_placeholder = __( 'Apartment, suite, unit, etc. (optional)', 'woocommerce' );
	} else {
		$address_2_placeholder = __( 'Apartment, suite, unit, etc.', 'woocommerce' );
	}

	$fields = array(
		'first_name' => array(
			'label'        => __( 'First name', 'woocommerce' ),
			'required'     => true,
			'class'        => array( 'form-row-first' ),
			'autocomplete' => 'given-name',
			'priority'     => 10,
		),
		'last_name'  => array(
			'label'        => __( 'Last name', 'woocommerce' ),
			'required'     => true,
			'class'        => array( 'form-row-last' ),
			'autocomplete' => 'family-name',
			'priority'     => 20,
		),
		'company'    => array(
			'label'        => __( 'Company name', 'woocommerce' ),
			'class'        => array( 'form-row-wide' ),
			'autocomplete' => 'organization',
			'priority'     => 30,
			'required'     => 'required' === get_option( 'woocommerce_checkout_company_field', 'optional' ),
		),
		'country'    => array(
			'type'         => 'country',
			'label'        => __( 'Country / Region', 'woocommerce' ),
			'required'     => true,
			'class'        => array( 'form-row-wide', 'address-field', 'update_totals_on_change' ),
			'autocomplete' => 'country',
			'priority'     => 40,
		),
		'address_1'  => array(
			'label'        => __( 'Street address', 'woocommerce' ),
			/* translators: use local order of street name and house number. */
			'placeholder'  => esc_attr__( 'House number and street name', 'woocommerce' ),
			'required'     => true,
			'class'        => array( 'form-row-wide', 'address-field' ),
			'autocomplete' => 'address-line1',
			'priority'     => 50,
		),
		'address_2'  => array(
			'placeholder'  => esc_attr( $address_2_placeholder ),
			'class'        => array( 'form-row-wide', 'address-field' ),
			'autocomplete' => 'address-line2',
			'priority'     => 60,
			'required'     => 'required' === get_option( 'woocommerce_checkout_address_2_field', 'optional' ),
		),
		'city'       => array(
			'label'        => __( 'Town / City', 'woocommerce' ),
			'required'     => true,
			'class'        => array( 'form-row-wide', 'address-field' ),
			'autocomplete' => 'address-level2',
			'priority'     => 70,
		),
		'state'      => array(
			'type'         => 'state',
			'label'        => __( 'State / County', 'woocommerce' ),
			'required'     => true,
			'class'        => array( 'form-row-wide', 'address-field' ),
			'validate'     => array( 'state' ),
			'autocomplete' => 'address-level1',
			'priority'     => 80,
		),
		'postcode'   => array(
			'label'        => __( 'Postcode / ZIP', 'woocommerce' ),
			'required'     => true,
			'class'        => array( 'form-row-wide', 'address-field' ),
			'validate'     => array( 'postcode' ),
			'autocomplete' => 'postal-code',
			'priority'     => 90,
		),
	);

	if ( 'hidden' === get_option( 'woocommerce_checkout_company_field', 'optional' ) ) {
		unset( $fields['company'] );
	}

	if ( 'hidden' === get_option( 'woocommerce_checkout_address_2_field', 'optional' ) ) {
		unset( $fields['address_2'] );
	}

	$default_address_fields = apply_filters( 'woocommerce_default_address_fields', $fields );
	// Sort each of the fields based on priority.
	uasort( $default_address_fields, 'wc_checkout_fields_uasort_comparison' );

	return $default_address_fields;
}