Forum
Unformatted price for product.html
I have my currency decimal place formatting to be 2 decimal places because I need to properly add tax in fractional dollars in my cart.
However, on product.html
I would like to display whole numbers to the user.
The attribute type="shop_currency_value"
seems to be preventing me from doing so. shop_currency_value
is using my default 2 decimal places, and I have been unable to add format=""
to override it.
Any attempt at formatting just returns zeros.
Is there a way to grab an unformatted price in product.html
?
Thank you!
I think nearly every total has a formatted and unformatted version. Have you checked
<perch:showall>
?Hi Drew, thank you.
<perch:showall>
does return the price unformatted, no decimals, as I've entered it, and the available id's areprice
perch_price
andcurrent_price
.None of these work with money formats i.e.
format="$:%.2n"
-- they return only zeros, not even a dollar sign.If I remove
type="shop_currency_value"
, the price will display in my desired format, but it will not flow through to the cart.Can you show me the full template tag you’re using?
<perch:shop id="price" type="shop_currency_value" label="Price" divider-before="Pricing" size="m" min="0" step="any" format="$:%.0n" />
I've played around a lot with the format...even trying # formats vs. $
Hi Olympia,
product.html
is the default edit form template. If you are using it as a display template too, I think you can do something like this:Yes, I'm using it as a display template as well. Thank you very much, that's a perfect solution.