Made wc_get_wildcard_postcodes return the orignal postcode plus * since wildcards should match empty strings too.
Fixes #12016
This commit is contained in:
parent
3e11e168cd
commit
a7e531e26d
|
@ -1245,13 +1245,16 @@ function wc_help_tip( $tip, $allow_html = false ) {
|
|||
* @return string[]
|
||||
*/
|
||||
function wc_get_wildcard_postcodes( $postcode, $country = '' ) {
|
||||
$postcodes = array( $postcode );
|
||||
$postcode = wc_format_postcode( $postcode, $country );
|
||||
$postcodes[] = $postcode;
|
||||
$postcode_length = strlen( $postcode );
|
||||
$formatted_postcode = wc_format_postcode( $postcode, $country );
|
||||
$length = strlen( $formatted_postcode );
|
||||
$postcodes = array(
|
||||
$postcode,
|
||||
$formatted_postcode,
|
||||
$formatted_postcode . '*',
|
||||
);
|
||||
|
||||
for ( $i = 0; $i < $postcode_length; $i ++ ) {
|
||||
$postcodes[] = substr( $postcode, 0, ( $i + 1 ) * -1 ) . '*';
|
||||
for ( $i = 0; $i < $length; $i ++ ) {
|
||||
$postcodes[] = substr( $formatted_postcode, 0, ( $i + 1 ) * -1 ) . '*';
|
||||
}
|
||||
|
||||
return $postcodes;
|
||||
|
|
|
@ -181,6 +181,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woocommerce/wo
|
|||
* When deleting a tax rate class, remove it's tax rates.
|
||||
* Made the store notice dismissible.
|
||||
* Improved the zone setup flow.
|
||||
* Made wc_get_wildcard_postcodes return the orignal postcode plus * since wildcards should match empty strings too.
|
||||
|
||||
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce/master/CHANGELOG.txt).
|
||||
|
||||
|
|
Loading…
Reference in New Issue