WordPress at Your Fingertips
function is not described

WC_Shipping_Zone::clear_locations() public WC 1.0

Clear all locations for this zone.

{} It's a method of the class: WC_Shipping_Zone{}

No Hooks.

Return

null. Nothing.

Usage

$WC_Shipping_Zone = new WC_Shipping_Zone();
$WC_Shipping_Zone->clear_locations( $types, fooo, foooo, fooooo ) );
$types(array|string)
of location to clear.
Default: array( foo
fooo (required)
-
foooo (required)
-
fooooo ) (required)
-

Code of WC_Shipping_Zone::clear_locations() WC 5.7.1

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 );
}