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

WC_Shipping_Zone::get_formatted_location() public WC 1.0

Return a text string representing what this zone is for.

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

Хуков нет.

Возвращает

Строку.

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

$WC_Shipping_Zone = new WC_Shipping_Zone();
$WC_Shipping_Zone->get_formatted_location( $max, $context );
$max(число)
Max locations to return.
$context(строка)
View or edit context.

Код WC_Shipping_Zone::get_formatted_location() WC 5.0.0

<?php
public function get_formatted_location( $max = 10, $context = 'view' ) {
	$location_parts = array();
	$all_continents = WC()->countries->get_continents();
	$all_countries  = WC()->countries->get_countries();
	$all_states     = WC()->countries->get_states();
	$locations      = $this->get_zone_locations( $context );
	$continents     = array_filter( $locations, array( $this, 'location_is_continent' ) );
	$countries      = array_filter( $locations, array( $this, 'location_is_country' ) );
	$states         = array_filter( $locations, array( $this, 'location_is_state' ) );
	$postcodes      = array_filter( $locations, array( $this, 'location_is_postcode' ) );

	foreach ( $continents as $location ) {
		$location_parts[] = $all_continents[ $location->code ]['name'];
	}

	foreach ( $countries as $location ) {
		$location_parts[] = $all_countries[ $location->code ];
	}

	foreach ( $states as $location ) {
		$location_codes   = explode( ':', $location->code );
		$location_parts[] = $all_states[ $location_codes[0] ][ $location_codes[1] ];
	}

	foreach ( $postcodes as $location ) {
		$location_parts[] = $location->code;
	}

	// Fix display of encoded characters.
	$location_parts = array_map( 'html_entity_decode', $location_parts );

	if ( count( $location_parts ) > $max ) {
		$remaining = count( $location_parts ) - $max;
		// @codingStandardsIgnoreStart
		return sprintf( _n( '%s and %d other region', '%s and %d other regions', $remaining, 'woocommerce' ), implode( ', ', array_splice( $location_parts, 0, $max ) ), $remaining );
		// @codingStandardsIgnoreEnd
	} elseif ( ! empty( $location_parts ) ) {
		return implode( ', ', $location_parts );
	} else {
		return __( 'Everywhere', 'woocommerce' );
	}
}