# Is It Possible To Have Decimals In Weights?

CS-Cart seems to have limits to how many decimals can be used to define weight. For example if you have a product of 13 grams, then you cannot set this as 0.013 kg. because CS-Cart imposes a limit of one decimal. i.e. 0.01 kg.

To resolve this we just changed the setting of the store to use grams instead. But shipping method charges -> weight dependencies now uses grams as well and minimum shipping cost per grams is 1. No decimals can be used at all, so the minimum shipping cost per kg is always â‚¬1000. This results in crazy shipping costs.

So in hindsight, we resolved a problem by creating a much bigger one.

Is there any way to make it possible to use decimals in the weight fields? This would resolve our problems.

I guess not. So if a store has lightweight products, then it's not possible to have both correct product weight and charge shipping costs per kg.

I guess not. So if a store has lightweight products, then it's not possible to have both correct product weight and charge shipping costs per kg.

Here is how I have my shipping set up for Australia Post in v2.2.5, hope it may be helpful
Weight symbol: Grams
Grams in the unit of weight defined by the weight symbol:1
the Product/shipping Properties
Weight (Grams): 13.00(example)
Shipping methods
Pos. Name Delivery Time Weight Limit (Grams) User Groups Status
10 Australia Post Regular Parcels Delivery 1-3 days 0.00 - 20000.00 All Active

Not sure if I fully understand but...

In my 3.06 version I can set shipping cost per g @ 0.01 ?

Shipping methods
Pos. Name Delivery Time Weight Limit (Grams) User Groups Status
10 Australia Post Regular Parcels Delivery 1-3 days 0.00 - 20000.00 All Active

For set prices per parcel this works. But many carriers charge a base cost plus a cost per KG. Its impossible to set a cost per KG is you set the store weight to grams.

Not sure if I fully understand but...

In my 3.06 version I can set shipping cost per g @ 0.01 ?

A gram is 0.001 KG. Its not possible to set 3 decimals in CS-Cart. So the lowest weight in 10 grams (0.01) unless you change the whole store to grams. Which causes the aforementioned problem.

These previous topics on the subject may help:

http://forum.cs-cart.com/topic/16606-shipping-weight-in-kgs/
http://forum.cs-cart.com/topic/39994-decimal-point-shippings-per-gram/

Thanks. The second topic includes a fix for a similar bug:

app\functions\fn.cart.php

find the fn_normalized_shipping_rate function and replace

```\$v['value'] = fn_format_price(\$v['value']);
```
with
```if (\$rate_type == 'W') {
\$v['value'] = fn_format_price(\$v['value'], CART_PRIMARY_CURRENCY, 3);
} else {
\$v['value'] = fn_format_price(\$v['value']);
}
```
Hope this will help

Hopefully someone can provide a similar solution for product weight.

If you modify your database, you will be able to enter 3 decimals for product.

Use this script:

`ALTER TABLE `cscart_products` CHANGE `weight` `weight` DECIMAL( 12, 3 ) NOT NULL DEFAULT '0.00';`

And you will be able to set the product weight in kg, like 0.013 (kg).

cs-cart 436 has 0.000 g weight

I want to have only 0.0 g would below solution work for 436 latest cs-cart ?

If you modify your database, you will be able to enter 3 decimals for product.

Use this script:

`ALTER TABLE `cscart_products` CHANGE `weight` `weight` DECIMAL( 12, 3 ) NOT NULL DEFAULT '0.00';`

And you will be able to set the product weight in kg, like 0.013 (kg).

Darius, yes, it should help you. Change 0.00 to 0.0 just in case