In WooCommerce I would like to Display Product Dimensions from product metabox in summary of single product pages. Is it possible?
Any track is appreciated.
Edit - More detail:
I have an option in my theme setting like this:
When I enable this option I have product page like this image:
I'd like to disable this option from my theme setting and then use a snippet to show Dimensions only.
The following hooked function will display formatted product dimensions (only) under product short description in product single pages:
add_action( 'woocommerce_single_product_summary', 'display_product_formated_dimensions_table', 25 );
function display_product_formated_dimensions_table(){
global $product;
if ( $product->has_dimensions() ) {
echo '<table class="shop_attributes"><tr>
<th>' . __( 'Dimensions', 'woocommerce' ) . '</th>
<td class="product_dimensions">' . esc_html( wc_format_dimensions( $product->get_dimensions( false ) ) ) . '</td>
</tr></table>';
}
}
Code goes in function.php file of your active child theme (or active theme). Tested and works.