title: WooCommerce rounding before calculate totals
body: <p>I'm using WooCommerce version 3.0+ as well as a price by user roles plugin which gives a % discount against prices.</p>
  
  <p>We have an item in the shop which is £89.55. With a 30% discount applied this becomes £62.685. If you order 6 then the value is £376.11.</p>
  
  <p>The final figure is correct.</p>
  
  <p>However as I have WC settings set to 2dp, the item price shows as £62.69. Therefore invoices are incorrect showing as £62.69 x 6 = £376.11.</p>
  
  <p>I've thought about using woocommerce_before_calculate_totals like from here:</p>
  
  <p><a href="https://stackoverflow.com/questions/43885585/dynamic-cart-item-pricing-not-working-on-orders-in-woocommerce-3-0">Dynamic cart item pricing not working on orders in WooCommerce 3.0+</a></p>
  
  <p>My code is:</p>
  
  <pre><code>add_action( 'woocommerce_before_calculate_totals', 'adding_custom_price', 10, 1);
  function adding_custom_price( $cart_obj ) {
  
  if ( is_admin() &amp;&amp; ! defined( 'DOING_AJAX' ) )
      return;
  
   foreach ( WC()-&gt;cart-&gt;get_cart() as $cart_item_key =&gt; $cart_item ) {
       $new_price = round($cart_item['data']-&gt;price,2,PHP_ROUND_HALF_UP);
       $cart_item['data']-&gt;set_price($new_price);
       #echo $new_price;
   }
  </code></pre>
  
  <p>}</p>
  
  <p>The output from the echo $new_price is 62.69. But it seems set_price isn't working as the values in the cart are still showing as for 62.685.</p>
  
  <p>So for example if I do 62.69 x 2 the subtotal is 125.37.</p>
  
  <p>Any idea why set_price isn't working? I saw this:</p>
  
  <p><a href="https://stackoverflow.com/questions/39867194/woocommerce-cart-itemdata-set-price-is-not-working-inside-custom-plugin">Woocommerce: $cart_item[&#39;data&#39;]-&gt;set_price is not working inside custom plugin</a></p>
  
  <p>But the answer on there doesn't work either.</p>
  
  <p>Any help much appreciated.</p>