1. Documentation /
  2. Display product dimensions on archive pages

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