WC_Countries::get_continents │ public │ WC 1.0

Get all continents.

Method of the class: WC_Countries{}

Hooks from the method

Returns

array.

Usage

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

WC_Countries::get_continents() code WC 11.3.0

public function get_continents() {
	$locale = $this->get_cache_locale();

	if ( empty( $this->geo_cache['continents'][ $locale ] ) ) {
		if ( isset( $this->geo_cache_building['continents'][ $locale ] ) ) {
			return array();
		}

		$this->geo_cache_building['continents'][ $locale ] = true;

		try {
			/**
			 * Allows filtering of continents in WC.
			 *
			 * @since 2.6.0
			 *
			 * @param array[array] $continents
			 */
			$this->geo_cache['continents'][ $locale ] = apply_filters( 'woocommerce_continents', include WC()->plugin_path() . '/i18n/continents.php' );
		} finally {
			unset( $this->geo_cache_building['continents'][ $locale ] );
		}
	}

	return $this->geo_cache['continents'][ $locale ];
}