Skip to content

Instantly share code, notes, and snippets.

@coenjacobs
Created May 4, 2012 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coenjacobs/2594971 to your computer and use it in GitHub Desktop.
Save coenjacobs/2594971 to your computer and use it in GitHub Desktop.
Display WooCommerce product dimensions on archive pages, right below the title of the product
<?php
/*
Plugin Name: WooCommerce Show Dimensions On Archive
Description: Display product dimensions on archive pages, right below the title of the product.
Version: 1.0
Author: Coen Jacobs
Author URI: http://coenjacobs.me
*/
add_action( 'woocommerce_after_shop_loop_item_title', 'cj_show_dimensions', 9 );
function cj_show_dimensions() {
global $product;
$dimensions = $product->get_dimensions();
if ( ! empty( $dimensions ) ) {
echo '<span class="dimensions">' . $dimensions . '</span>';
}
}
?>
@kaviarasukr
Copy link

kaviarasukr commented Feb 7, 2017

hi Great Stuff!!! Instead of displaying just the dimensions i need to display in the format of https://jsfiddle.net/kaviarasukr/z8byafmq/ any ideas of how to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment