Title: Round Weight
Last modified: April 16, 2020

---

# Round Weight

 *  [fabiowork](https://wordpress.org/support/users/fabiowork/)
 * (@fabiowork)
 * [6 years ago](https://wordpress.org/support/topic/round-weight/)
 * On the customer’s website will have shipping by weight
    But from “x” weight begins
   to have an additional cost per kg
 * I know you can add the price per kg but the product counts the grams and not 
   the total kg
 * ex:
    1 kg – 32.40 More than 1 kg – 32.40 (for the first kg) + 4 EUR per extra
   kg
 * If the product is 1.30 Kg counts that weight and not 2kg
    And I want it to count
   2kg
 * Thx

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Joey – a11n](https://wordpress.org/support/users/jricketts4/)
 * (@jricketts4)
 * [6 years ago](https://wordpress.org/support/topic/round-weight/#post-12683567)
 * [@fabiowork](https://wordpress.org/support/users/fabiowork/) – can you send a
   screenshot of your product settings? I’m having a little bit of a hard time understanding
   how you’re currently charging for a product based on weight with default WooCommerce
   functionality.
 * – Joey
 *  [con](https://wordpress.org/support/users/conschneider/)
 * (@conschneider)
 * Engineer
 * [6 years ago](https://wordpress.org/support/topic/round-weight/#post-12684650)
 * Hi there,
 * This will always round the weight in cart up.
 *     ```
       add_filter('woocommerce_cart_contents_weight', 'round_cart_contents_weight');
       function round_cart_contents_weight($weight) {
       	$weight = ceil($weight);
       	return $weight;
       }
       ```
   
 * Kind regards,
 *  Thread Starter [fabiowork](https://wordpress.org/support/users/fabiowork/)
 * (@fabiowork)
 * [6 years ago](https://wordpress.org/support/topic/round-weight/#post-12685191)
 * Thx for helping
    Where i can add this code on my site?
 *  Plugin Support [Fernando a11n](https://wordpress.org/support/users/fhaps/)
 * (@fhaps)
 * Automattic Happiness Engineer
 * [6 years ago](https://wordpress.org/support/topic/round-weight/#post-12686358)
 * [@fabiowork](https://wordpress.org/support/users/fabiowork/) You’ll want to add
   that to your theme’s functions.php file.
 * If you are not familiar with coding, I don’t recommend messing up with the files
   themselves. In that case, you can use a plugin like [Code Snippets](https://wordpress.org/plugins/code-snippets/),
   which will let you add the snippet through the admin dashboard.
 *  Thread Starter [fabiowork](https://wordpress.org/support/users/fabiowork/)
 * (@fabiowork)
 * [6 years ago](https://wordpress.org/support/topic/round-weight/#post-12689003)
 * I put the code in both functions.php of my theme and the snippet code and it’s
   not working because the price of the weight per kg is counting the grams
 *  Thread Starter [fabiowork](https://wordpress.org/support/users/fabiowork/)
 * (@fabiowork)
 * [6 years ago](https://wordpress.org/support/topic/round-weight/#post-12689121)
 * I put the code in both functions.php of my theme and the snippet code and it’s
   not working because the price of the weight per kg is counting the grams and 
   not the total kg

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Round Weight’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 6 replies
 * 4 participants
 * Last reply from: [fabiowork](https://wordpress.org/support/users/fabiowork/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/round-weight/#post-12689121)
 * Status: not resolved