Copy product-attributes.php from /plugins/woocommerce/templates/single-product/ folder to /themes/your_theme/woocommerce/single-product/ folder, then edit it and replace
<?php if ( $display_dimensions && $product->has_dimensions() ) : ?>
<tr>
<th><?php _e( 'Dimensions', 'woocommerce' ) ?></th>
<td class="product_dimensions"><?php echo esc_html( wc_format_dimensions( $product->get_dimensions( false ) ) ); ?></td>
</tr>
<?php endif; ?>
with
<?php if ( $display_dimensions && $product->has_dimensions() ) : ?>
<tr>
<th>Length</th>
<td class="product_dimensions"><?php echo $product->get_length() . get_option( 'woocommerce_dimension_unit' ); ?></td>
</tr>
<tr>
<th>Width</th>
<td class="product_dimensions"><?php echo $product->get_width() . get_option( 'woocommerce_dimension_unit' ); ?></td>
</tr>
<tr>
<th>Height</th>
<td class="product_dimensions"><?php echo $product->get_height() . get_option( 'woocommerce_dimension_unit' ); ?></td>
</tr>
<?php endif; ?>
-
This reply was modified 9 years ago by
superkot.
Thread Starter
dan11
(@dan11)
Works beautifully, thanks so much
I wonder if it would be possible to add a custom dimension, like a diameter or seat-height? How would I go about doing that?
Thread Starter
dan11
(@dan11)
I was able to achieve what I was trying with the above replacement code thank you!
But how can I make it so if the product doesn’t have length, there will be no “Length” row?