When adding a (commerce_price:number) field in views there's no way to remove the unwanted trailing zeros after the decimal point in the field's Configure field window.

screenshot

Comments

the_glitch created an issue. See original summary.

the_glitch’s picture

Issue summary: View changes
beakerboy’s picture

What is your desired behavior? Round, floor, ceiling, or truncate?

the_glitch’s picture

usually ceiling but all options would be nice. Also options of decimal scale would be nice too.

jsacksick’s picture

Category: Bug report » Support request
Status: Active » Fixed

You should use the regular price field (not commerce_price:number) and use the default formatter. If you do not want to show the currency code/symbol, you can do that and also remove trailing zeroes.
If you need more customization options, I'd suggest writing your own field formatter.

the_glitch’s picture

At this point in time I need to use price:number because I'm using the value in views_simple_math_field formula and it doesn't recognise the numeric value of price fields because of the currency code and symbol.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

the_glitch’s picture

Can somebody please re-open this issue as the unwanted trailing zeros are still an issue?

the_glitch’s picture

Category: Support request » Bug report
Priority: Normal » Major
alfthecat’s picture

+1 for re-opening this, as I can confirm this is still an issue. In my case, I'm trying to make a "Total sales" block that sums the "Total price" field on orders. When using aggregation, I get results like:
Total: 10, 320.000000

There is no way to change the formatter or apply decimal settings.

alfthecat’s picture

For those bumping into this problem, a dirty work around is to install the views_simple_math_field, entering the formula of @yourfield*1 and then setting the rounding to your needs.