Display product dimensions on archive pages

This is a Developer level doc. If you are unfamiliar with code and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our  Support Policy.

You need to add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme. Display WooCommerce product dimensions on archive pages, below the title of the product.

WooCommerce version 3.0+

↑ Back to top
/**
* Show product dimensions on archive pages for WC 3+
*/
add_action( 'woocommerce_after_shop_loop_item', 'rs_show_dimensions', 9 );
function rs_show_dimensions() {
global $product;
$dimensions = wc_format_dimensions($product->get_dimensions(false));
if ( $product->has_dimensions() ) {
echo '<div class="product-meta"><span class="product-meta-label">Dimensions: </span>' . $dimensions . '</div>';
}
}

WooCommerce version lower than 3.0

↑ Back to top
/**
* Show product dimensions on archive pages WC 3 and below
*/
add_action( 'woocommerce_after_shop_loop_item_title', 'wc_show_dimensions', 9 );
function wc_show_dimensions() {
global $product;
$dimensions = $product->get_dimensions();
if ( ! empty( $dimensions ) ) {
echo '<span class="dimensions">' . $dimensions . '</span>';
}
}
Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.