WC_Tax::_update_tax_rate_postcodes( int $tax_rate_id, string $postcodes )

Update postcodes for a tax rate in the DB.


Description Description

Internal use only.


Parameters Parameters

$tax_rate_id

(Required) Tax rate to update.

$postcodes

(Required) String of postcodes separated by ; characters.


Top ↑

Source Source

File: includes/class-wc-tax.php

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

Top ↑

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.