Код: Выделить всё
woocommerce_format_dimensionsКод: Выделить всё
add_filter( 'woocommerce_format_dimensions', 'custom_formated_product_dimentions', 10, 2 );
function custom_formated_product_dimentions( $dimension_string, $dimensions ){
if ( empty( $dimension_string ) )
return __( 'N/A', 'woocommerce' );
$dimensions = array_filter( array_map( 'wc_format_localized_decimal', $dimensions ) );
foreach( $dimensions as $key => $dimention )
$label_with_dimensions[$key] = $dimention . ' ' . strtoupper( substr($key, 0, 1) ) . ' ' . get_option( 'woocommerce_dimension_unit' ) . '.';
return implode( ' x ', $label_with_dimensions);
}
Код: Выделить всё
var_dumpКод: Выделить всё
array(3) { ["length"]=> string(3) "104" ["width"]=> string(3) "136" ["height"]=> string(2) "53" }
1 В дюйм x 1 Ш дюйм x 1 Г дюйм
Я пытался переименовать ключи в массиве $dimensions, используя
Код: Выделить всё
array_mapПодробнее здесь: https://stackoverflow.com/questions/454 ... ons-output
Мобильная версия