WC_Shipping_Zone::clear_locations()publicWC 1.0

Clear all locations for this zone.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$WC_Shipping_Zone = new WC_Shipping_Zone();
$WC_Shipping_Zone->clear_locations( $types, fooo, foooo, fooooo ) );
$types(массив|строка)
of location to clear.
По умолчанию: array( foo
fooo (обязательный)
-
foooo (обязательный)
-
fooooo ) (обязательный)
-

Код WC_Shipping_Zone::clear_locations() WC 8.7.0

public function clear_locations( $types = array( 'postcode', 'state', 'country', 'continent' ) ) {
	if ( ! is_array( $types ) ) {
		$types = array( $types );
	}
	$zone_locations = $this->get_prop( 'zone_locations', 'edit' );
	foreach ( $zone_locations as $key => $values ) {
		if ( in_array( $values->type, $types, true ) ) {
			unset( $zone_locations[ $key ] );
		}
	}
	$zone_locations = array_values( $zone_locations ); // reindex.
	$this->set_prop( 'zone_locations', $zone_locations );
}