How to change Weight Attribute decimals Magento

There is no simple way to change the decimal numbers in the Weight Attribute in Magento.

And is not a specific solution either.

What can we do?

For example, we can force to all numeric attributes to show with 2 decimals.

Open the attributes.phtml located in:

app/design/frontend/YOUR THEME/template/catalog/product/view/

I changed this:

productAttribute($_product, strip_tags($_data['value']), $_data['code']) ?>

To this:

productAttribute($_product, strip_tags($_MyValue), $_data['code']) ?>

What it does?

The code above adds a condition is_numeric and uses the round function to round it πŸ˜‰

After it we just print again the attributes with our new value, in this case $my_data_value

About Rick

Senior Front-end Software Engineer from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

Leave a Reply

Add <code> Some Code </code> by using this tags.