Shopify / Shopify/liquid

abs and round filters

Open
#1,087 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

In Progress
Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

I have for example -17.00 price (minus seventeen and zero zero, it is the difference between current variant and default/first variant prices).
I'd like to get 17.00
When I apply:
{{ -17.00 | abs | round:2 }}
or
{{ -17.00 | round:2 | abs }}
I'm getting 17.0, not 17.00
How can I get 17.00 ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported Liquid expressions using -17.00 with the abs and round filters, then locate the filter implementation and its related tests. Determine whether preserving two decimal places is expected, and consider the work done when the behavior is covered by a test and the documented output matches the intended formatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.