Created
March 28, 2021 11:06
-
-
Save DxDiagDx/67ef10e56e5282773c081727d9874364 to your computer and use it in GitHub Desktop.
Woo: перевод на русский язык единиц измерения
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_format_weight', 'localize_weight_units'); | |
function localize_weight_units($weight) { | |
if ( strpos($weight, 'kg') !== false ) { | |
return str_replace('kg', 'кг', $weight); | |
} | |
else { | |
return str_replace('g', 'гр', $weight); | |
} | |
} | |
add_filter('woocommerce_format_dimensions', 'localize_dimensions_units'); | |
function localize_dimensions_units($dimensions) { | |
if ( strpos($dimensions, 'cm') !== false ) { | |
return str_replace('cm', 'см', $dimensions); | |
} | |
elseif ( strpos($dimensions, ' mm') !== false ) { | |
return str_replace(' mm', ' мм', $dimensions); | |
} | |
else { | |
return str_replace(' m', ' м', $dimensions); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment