WC_Countries::get_shipping_continents()publicWC 3.6.0

Get continents that the store ships to.

Method of the class: WC_Countries{}

No Hooks.

Return

Array.

Usage

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

Changelog

Since 3.6.0 Introduced.

WC_Countries::get_shipping_continents() code WC 9.4.2

public function get_shipping_continents() {
	$continents             = $this->get_continents();
	$shipping_countries     = $this->get_shipping_countries();
	$shipping_country_codes = array_keys( $shipping_countries );
	$shipping_continents    = array();

	foreach ( $continents as $continent_code => $continent ) {
		if ( count( array_intersect( $continent['countries'], $shipping_country_codes ) ) ) {
			$shipping_continents[ $continent_code ] = $continent;
		}
	}

	return $shipping_continents;
}