Skip to content
Discussion options

You must be logged in to vote

The Money fieldtype converts the cents into a formatted string as part of the augmentation process. It's similar to how the Markdown fieldtype outputs HTML rather than actual Markdown.

It makes it easy to display totals without needing to handle the formatting yourself. If you'd prefer to work with cents, you can use raw modifier in your templates to get the "un-augmented" value:

{{ cart:subtotal | raw }}

The JSON API returns the augmented values so you can't get the raw values there yourself. You'd have to convert it back to pence manually in JS, like this:

cart.subtotal.replace('.', '').replace('€', '')

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Oleafeon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants