title: Display the total weight of each item at cart and checkout page in WooCommerce
body: <p>I read and tried the one at this link:</p>
  
  <p><a href="https://stackoverflow.com/questions/42768375/display-the-weight-of-each-cart-items-in-woocommerce">Display the weight of each cart items in WooCommerce</a></p>
  
  <p>It does not work.  I need to have the total weight of each item at cart and checkout; for example the weight of an article is 500 gr and if I add to the cart 3 of his article, it should show 1500 gr.</p>
  
  <p>I have configured the weight for some products at 0.2 kg (becouse the wordpress system is configured in Kg) but if I try that code in the previous link, under the name of the product , it shows me "<strong>weight 0</strong>".</p>
  
  <p>I have used this code:</p>
  
  <pre class="lang-php prettyprint-override"><code>add_filter( 'woocommerce_get_item_data', 'displaying_cart_items_weight', 10, 2 );
  function displaying_cart_items_weight( $item_data, $cart_item ) {
      $item_weight = $cart_item['data']-&gt;get_weight() * $product_qty;
      $item_data[] = array(
          'key'       =&gt; __('Weight', 'woocommerce'),
          'value'     =&gt; $item_weight,
          'display'   =&gt; $item_weight . ' ' . get_option('woocommerce_weight_unit')
      );
      return $item_data;
  }
  </code></pre>
  
  <hr>
  
  <p>Then I tried another code to have the total cart weight and it works perfectly , for each change I make in the cart, the weight is correct. The code I used is:</p>
  
  <pre class="lang-php prettyprint-override"><code>    if ( WC()-&gt;cart-&gt;needs_shipping() ) : ?&gt;
          &lt;tr class="shipping"&gt;
              &lt;th&gt;&lt;?php _e( 'Peso', 'woocommerce-cart-weight' ); ?&gt;&lt;/th&gt;
              &lt;td&gt;&lt;span class="label"&gt;&lt;?php echo $woocommerce-&gt;cart-&gt;cart_contents_weight . ' ' . get_option( 'woocommerce_weight_unit' ); ?&gt;&lt;/span&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;?php endif;
  }
  add_action( 'woocommerce_cart_totals_after_order_total', 'wcw_cart' );
  add_action( 'woocommerce_review_order_after_order_total', 'wcw_cart' );
  </code></pre>
  
  <p>I need absolutely the total weight for each item line (not the weight for a single product only) :
  the result should be given from item_weight * item_quantity  (0.2 x 6 = 1.2)</p>
  
  <hr>
  
  <p>Is it possible to have this information also in single product page? when a user change the value of the quantity to add to cart, the system should show also the total weight, example: a product weight is 0.2 kg  if the user change the value from 1 to 2 , the weight showed should be 0.4 , if the value is 3 so the total weight should be 0.6 and then the user click on add to cart.</p>
  
  <p>I am usic this code below to change price total on quantity change:</p>
  
  <pre><code>add_action( 'woocommerce_single_product_summary',
   'woocommerce_total_product_price', 31 );
  function woocommerce_total_product_price() {
  global $woocommerce, $product;
  // let's setup our divs
  echo sprintf('&lt;div id="product_total_price" style="margin-bottom:20px;"&gt;%s
   %s&lt;/div&gt;',__('Totale Prodotto:','woocommerce'),'&lt;span 
  class="price"&gt;'.$product-&gt;get_price().'&lt;/span&gt;');
  ?&gt;
      &lt;script&gt;
          jQuery(function($){
              var price = &lt;?php echo $product-&gt;get_price(); ?&gt;,
                  currency = '&lt;?php echo get_woocommerce_currency_symbol(); 
  ?&gt;';
  
              $('[name=quantity]').change(function(){
                  if (!(this.value &lt; 1)) {
  
                      var product_total = parseFloat(price * this.value);
  
                      $('#product_total_price .price').html( currency + 
  product_total.toFixed(2));
  
                  }
              });
          });
      &lt;/script&gt;
  &lt;?php
  
  }
  </code></pre>