title: Get tax rate separately for every cart and order items in Woocommerce
body: <p>I'd like to modify the cart display (and later the invoice) so that there is another column showing the tax and tax rate for each product. I have not found a function or a getter for the tax rate as a number, only the name, with $_product->get_tax_class(). I was looking for a function like $_product->get_tax_rate() but found none. So I wrote a terrible workaround in  woocommerce/templates/cart/cart.php.</p>
  
  <p>After the easy part of adding</p>
  
  <pre><code>&lt;th class="product-tax"&gt;&lt;?php esc_html_e( 'Tax', 'woocommerce' ); ?&gt;&lt;/th&gt;
  </code></pre>
  
  <p>in Line 35, I added from Line 121:</p>
  
  <pre><code>$tax_name = apply_filters( 'woocommerce_cart_item_tax', $_product-&gt;get_tax_class(), $cart_item, $cart_item_key );
  if ($tax_name == "reduced-tax-rate") $tax_rate= 7; else $tax_rate= 19;                      
  $with_tax = $_product-&gt;get_price( $_product ); 
  $without_tax = $with_tax/((100+$tax_rate)/100);
  $tax = $with_tax-$without_tax;
  $tax = $tax*$cart_item['quantity'];
  $tax = number_format($tax, 2, '.', '')." €";
  echo "  ".$tax." (".$tax_rate."%)";
  </code></pre>
  
  <p>This works for now, but only in Germany, and it would of course not survive for a very long time. So, what is the better way to do this?</p>
  
  <p>Thanks!</p>
  
  <p>UPDATE</p>
  
  <p>Just found half of the solution:</p>
  
  <pre><code>$tax_name = apply_filters( 'woocommerce_cart_item_tax', $_product-&gt;get_tax_class(), $cart_item, $cart_item_key );
  if ($tax_name == "reduced-tax-rate") $tax_rate= 7; else $tax_rate= 19;                      
  echo "  ".$cart_item['line_subtotal_tax']." (".$tax_rate."%)";
  </code></pre>
  
  <p>$cart_item['line_subtotal_tax'] holds the value I was trying to get by calculation. Now just the name is missing..."19%" or "7%"...</p>