Need to remove decimal and cents in price?

Highlighted
Shopify Partner
375 0 7

I would like to remove the decimal, cents, and USD from my product price so it will be displayed as $45 and not $45.00 USD.

I had a solution but it doesn't seem to be working.

Someone may have answered this for me before but I can't find it.

Fine Art and Photography by Matt Mikulla --> http://mattmikulla.com
0 Likes
Highlighted
Shopify Staff
Shopify Staff
5704 1 314
{{ product.price | money_without_currency | remove: '.00' }}
Caroline from http://11heavens.com ∴ mllegeorgesand AT gmail DOT com
3 Likes
Highlighted
Shopify Partner
375 0 7

Perfect. Thanks, you the awesome Caroline.

Fine Art and Photography by Matt Mikulla --> http://mattmikulla.com
0 Likes
Highlighted
Shopify Staff
Shopify Staff
5704 1 314

Someone asked for precisions...

These:

<h4>{{ product.price | money_without_currency | remove: '.00' }}</h4>
<h4>{{ product.price | money | remove: '.00' }}</h4>
<h4>{{ product.price | money_with_currency | remove: '.00' }}</h4>

Will give you:

20

 

$20

 

$20 USD

Caroline from http://11heavens.com ∴ mllegeorgesand AT gmail DOT com
1 Like
Highlighted
New Member
3 0 0

I have devided by 10 to show how much our cards are individually.

it shows 20, how do I have it show .20?

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
5711 0 139

I would do it like this:

 

<p class="price">.{{ product.price | divided_by: 10 }}</p>

 

 

http://shopifyplus.com ::: http://twitter.com/bacchus
0 Likes
Highlighted
Tourist
37 0 1

what if the number does not end in .00? for example 150.50?

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
5711 0 139

If it ends in .50 why would you want to remove the cents? The only way removing the cents places makes sense is if you have round prices that end in 0. This should not effect anything that doesn't end in .00 so you should be fine in any event.

 

{{ product.price | money | remove: '.00' }}

 

 

http://shopifyplus.com ::: http://twitter.com/bacchus
0 Likes
Highlighted
Shopify Partner
11 0 0

This all worked very well for the product page on my store, so thank you all for your help with that.

For some reason, I can't get the price to display without the .00 on the collection.category page.

Here is the current code:

 

<li>
				<span class="item-image"><a href="{{ product.url | within:subc }}" class="ili-top-image"><img src="{{ product.featured_image | product_img_url: 'medium' }}" alt="{{ product.title | escape }}"/></a></span>
				<h4><a href="{{ product.url | within:subc }}">{{ product.title }}</a></h4>
				<span class="price"> {{ product.price_min | money | remove: '.00' }} </span>
			</li>

 

Am I doing something wrong here?

 

http://looptyhoops.com
0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
5711 0 139

If you use options.js you will need to add that to the js callback at the very bottom of your template.

http://shopifyplus.com ::: http://twitter.com/bacchus
0 Likes