Woocommerce product dimensions not showing on first product

I am using WordPress with Woocommerce and would like the shop and archive pages to show the product dimensions along with the price and title of the product.

I added this code to my content-product.php woocommerce file: http://docs.woothemes.com/document/display-product-dimensions-on-archive-pages/

Read More

Which worked great! Except for the first product in the shop loop. Both on the shop page and in other product lists, the dimensions are not shown on the first product.

How might I resolve this?

Image:
http://postimg.org/image/7c5j4uoe1/

Related posts

1 comment

  1. 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>';
        }
    }
    

    The above code works well only under the following conditions:

    1. If dimensions are added to the product.

    2. This code should be coded in functions.php of the theme or your custom plugin. For coding in theme its better to create and use a child theme, code in its functions.php so that when that theme updates your code wont be overwritten.

    Have tried the same and followed these conditions. And the output was –

    enter image description here

Comments are closed.