Removing comma from four digit prices

Hi there, is is possible to adjust prices on our store so that commas are removed from four digit numbers (for example $1,000 >> $1000)? That being said, we do want to keep commas on five digit prices in our store.

This is a perfect question to ask Shopify Sidekick. Really very easy. This is only a sample, and will vary depending on theme:

could you possibly post the code here? I am trying to use Sidekick but it will not generate the code needed

What is the theme name?

@vcarley ,

In Shopify themes, prices are usually not controlled directly in the main product template. Most modern themes use a price snippet that is shared across product pages, collections, and cards.

Go to Edit Code → snippets/price.liquid in your Shopify theme and replace the normal price line (usually {{ price | money }}) with something like

{% assign price_value = price | divided_by: 100 %}

{% if price_value < 10000 %}
{{ price | money | remove: ',' }}
{% else %}
{{ price | money }}
{% endif %}

Sorry I’m not the best at this. I entered the code here and am getting a syntax error. See screenshot. Thanks for your help.

@vcarley

See image below:

You pasted this entire thing within the liquid tag, making all those {% and %} unnecessary because they already inside the {%- liquid -%}

The above comment didn’t take into account that you are adding code inside {%- liquid

So you can just delete all those {% and %} in the part you pasted

Hi @vcarley just a heads up. I’ve seen invalid code inside your liquid tag. I suggest moving this code block (see attached below) and place it right after -%}


And to remove commas from your prices I suggest putting this line of code
assign money_price = money_price | remove: ‘,’
assign price = price | remove': ‘,’

right before the condition if target == product and product.price_varies (see image below)

This approach will remove commas to your prices

Hmm I went ahead and made those edits and it does not appear to be working. See attached screen shot

Looks like you got some code inside the liquid tag, particulaly inside an if, and some code outside.

I’d just revert to original, then simply remove the comma from the places where {{ money_price | money }} or {{ money_price | money_with_currency }} is actually rendered, and change it to something like:

{{ money_price | money | remove: ‘,’ }}

Or

{{ money_price | money_with_currency | remove: ‘,’ }}

And

{{ money_price | money_without_currency }}

Would become

{{ money_price | money_without_currency | remove: ',' }}