commerce
commerce copied to clipboard
Small weight value being rounded to 0
Description
We have some products (springs) that are really small with a weight of 0.0002
pounds. When you enter that weight into the weight field and save it, the weight value is then set to 0. It looks like the smallest value that you can enter in weight is 0.0006
which is then rounded to 0.001
. Nothing immediately stuck out to me in the code that would cause this. I also looked at the DB column and saw it was DECIMAL 14,4
so there should be enough room to support that number of decimals.
I wasn't sure if this was an expected minimum, and I need to hook into a before save event to do some rounding or something else was going on. Thanks in advance.
Steps to reproduce
- Add a weight of
0.0002
to a variant - Save it
- See that the weight of the variant is now 0
Additional info
- Craft CMS version: Craft Pro 3.6.18
- Craft Commerce version: 3.3.0.1
- PHP version: 7.4.15
- Database driver & version: MySQL 5.7.29
- Plugins & versions:
Amazon S3 | 1.2.11 |
---|---|
Asset Rev | 6.0.2 |
Avatax | 2.1.6 |
Classnames | 1.0.3 |
Command Palette | 3.1.4 |
Craft Commerce | 3.3.0.1 |
Feed Me | 4.3.5.1 |
Imgix | 2.1.0 |
Linkit | 1.1.12.1 |
Navigation | 1.4.14 |
Postie | 2.4.7 |
Ray | 1.1.4 |
Redactor | 2.8.5 |
Retour | 3.1.53 |
Scout | dev-master |
SEOmatic | 3.3.41 |
Stripe for Craft Commerce | 2.3.2.1 |
Style Inliner | 2.3.0 |
Super Table | 2.6.7 |
Table Maker | 2.0.1 |
Hi @davist11
Thank you for raising this issue.
It looks like the value is being stored correctly but is shown on the form incorrectly and therefore if you were to resave would overwrite the value with the incorrect data. This is a bug that we will look to get fixed.
Thanks!
Fixed for the next release.