WC_Tax::_update_tax_rate_postcodes()public staticWC 2.3.0

Update postcodes for a tax rate in the DB.

Internal use only.

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

Хуков нет.

Возвращает

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

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

$result = WC_Tax::_update_tax_rate_postcodes( $tax_rate_id, $postcodes );
$tax_rate_id(int) (обязательный)
Tax rate to update.
$postcodes(строка) (обязательный)
String of postcodes separated by ; characters.

Список изменений

С версии 2.3.0 Введена.

Код WC_Tax::_update_tax_rate_postcodes() WC 9.4.2

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