auto-patch 638-dev-dev01-2024-05-14T20_44_36
This commit is contained in:
@@ -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 );
|
||||
@@ -1290,7 +1296,28 @@ function wc_format_stock_quantity_for_display( $stock_quantity, $product ) {
|
||||
* @return string
|
||||
*/
|
||||
function wc_format_sale_price( $regular_price, $sale_price ) {
|
||||
$price = '<del aria-hidden="true">' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</del> <ins>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price ) . '</ins>';
|
||||
// Format the prices.
|
||||
$formatted_regular_price = is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price;
|
||||
$formatted_sale_price = is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price;
|
||||
|
||||
// Strikethrough pricing.
|
||||
$price = '<del aria-hidden="true">' . $formatted_regular_price . '</del> ';
|
||||
|
||||
// For accessibility (a11y) we'll also display that information to screen readers.
|
||||
$price .= '<span class="screen-reader-text">';
|
||||
// translators: %s is a product's regular price.
|
||||
$price .= esc_html( sprintf( __( 'Original price was: %s.', 'woocommerce' ), wp_strip_all_tags( $formatted_regular_price ) ) );
|
||||
$price .= '</span>';
|
||||
|
||||
// Add the sale price.
|
||||
$price .= '<ins aria-hidden="true">' . $formatted_sale_price . '</ins>';
|
||||
|
||||
// For accessibility (a11y) we'll also display that information to screen readers.
|
||||
$price .= '<span class="screen-reader-text">';
|
||||
// translators: %s is a product's current (sale) price.
|
||||
$price .= esc_html( sprintf( __( 'Current price is: %s.', 'woocommerce' ), wp_strip_all_tags( $formatted_sale_price ) ) );
|
||||
$price .= '</span>';
|
||||
|
||||
return apply_filters( 'woocommerce_format_sale_price', $price, $regular_price, $sale_price );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user