plugin updates

This commit is contained in:
Tony Volpe
2024-06-17 14:48:11 -04:00
parent ecc5fbf831
commit 3751a5a1a6
1318 changed files with 91130 additions and 52250 deletions

View File

@@ -979,6 +979,9 @@ function wc_format_postcode( $postcode, $country ) {
$postcode = wc_normalize_postcode( $postcode ?? '' );
switch ( $country ) {
case 'SE':
$postcode = substr_replace( $postcode, ' ', -2, 0 );
break;
case 'CA':
case 'GB':
$postcode = substr_replace( $postcode, ' ', -3, 0 );
@@ -1004,9 +1007,12 @@ function wc_format_postcode( $postcode, $country ) {
$postcode = substr_replace( $postcode, ' ', 4, 0 );
break;
case 'LV':
if ( preg_match( '/(?:LV)?-?(\d+)/i', $postcode, $matches ) ) {
$postcode = count( $matches ) >= 2 ? "LV-$matches[1]" : $postcode;
}
$postcode = preg_replace( '/^(LV)?-?(\d+)$/', 'LV-${2}', $postcode );
break;
case 'CZ':
case 'SK':
$postcode = preg_replace( "/^({$country})-?(\d+)$/", '${1}-${2}', $postcode );
$postcode = substr_replace( $postcode, ' ', -2, 0 );
break;
case 'DK':
$postcode = preg_replace( '/^(DK)(.+)$/', '${1}-${2}', $postcode );