WordPress at Your Fingertips
function is not described

WC_Tax::_update_tax_rate_postcodes() public WC 2.3.0

Update postcodes for a tax rate in the DB.

Internal use only.

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

No Hooks.

Return

null. Nothing.

Usage

$result = WC_Tax::_update_tax_rate_postcodes( $tax_rate_id, $postcodes );
$tax_rate_id(int) (required)
Tax rate to update.
$postcodes(string) (required)
String of postcodes separated by ; characters.

Changelog

Since 2.3.0 Introduced.

Code of WC_Tax::_update_tax_rate_postcodes() WC 5.9.0

public static function _update_tax_rate_postcodes( $tax_rate_id, $postcodes ) {
	if ( ! is_array( $postcodes ) ) {
		$postcodes = explode( ';', $postcodes );
	}
	// No normalization - postcodes are matched against both normal and formatted versions to support wildcards.
	foreach ( $postcodes as $key => $postcode ) {
		$postcodes[ $key ] = strtoupper( trim( str_replace( chr( 226 ) . chr( 128 ) . chr( 166 ), '...', $postcode ) ) );
	}
	self::update_tax_rate_locations( $tax_rate_id, array_diff( array_filter( $postcodes ), array( '*' ) ), 'postcode' );
}