2

Expresso Store lets you determine your price decimal places globally. So even if you generally price things as whole dollars ($125.00), it's likely you'll need to set your display to 2 decimal places, since things like percent-based sales, shipping, and sales tax will require displaying the decimal places.

Is there any way, besides PHP, to override the decimal place setting right in the templates? I'm imagining something like {price decimals="0"} or maybe a more elaborate {price format="something"} where something apes PHP's money_format() syntax.

2

As Justin said, the best way to do this on a per-template basis is to use a separate add-on to format the number.

When you are using an add-on, remember there are _val variables available to you, which display the unformatted decimal. For example:

{price_val}
{sale_price_val}

Also if your price is a whole number, sometimes you can use these in your template to display it. E.g.

${price_val}

However, that won't work if some of your products do have a decimal place, or you want to consistently set the currency symbol or decimal separator.

1

There is nothing built into Store currently that would allow you to do that. Having said that there are a couple of plugins available already that you can use to format the numbers on the front-end without having to enable php in the the templates. Here are a few that I know of:

There might be more available, to get this added to the Feature Request list I would recommend email support@exp-resso.com so it might be added to a future release of Store.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.