WC_Tax::_update_tax_rate_cities()public staticWC 2.3.0

Update cities for a tax rate in the DB.

Internal use only.

Method of the class: WC_Tax{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Tax::_update_tax_rate_cities( $tax_rate_id, $cities );
$tax_rate_id(int) (required)
Tax rate to update.
$cities(string) (required)
Cities to set.

Changelog

Since 2.3.0 Introduced.

WC_Tax::_update_tax_rate_cities() code WC 9.3.3

public static function _update_tax_rate_cities( $tax_rate_id, $cities ) {
	if ( ! is_array( $cities ) ) {
		$cities = explode( ';', $cities );
	}
	$cities = array_filter( array_diff( array_map( array( __CLASS__, 'format_tax_rate_city' ), $cities ), array( '*' ) ) );

	self::update_tax_rate_locations( $tax_rate_id, $cities, 'city' );
}