-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Price range input placeholder/max values do not handle comma separated currencies (e.g. Euros) #255
Comments
I agree. Shopify definitely need to give us a better way to format the pricing. I don't think also that the decimal value should be exposed at all in the filter, because the increment is usually 1, and can make the prices extremely long. For now I have been able to create integer values using this, but I have no idea if this will work constantly for all currencies:
I think Shopify should expose additional variables:
|
That's definitely a concern. There are currencies that don't use a 100 cent basis. Some examples that I've been given are: OMR subdivides into 1000 baisa I agree - it would be very useful for there to be a platform feature to strip all of the special formatting and return a price in a way that the number input can use. My current thinking is something along the lines of a money filter that, similar to So it would be a filter that will always output the currency with no thousands separator and a
This is very interesting. We'd need to base this on some sort of standard for each particular currency, and maybe it would be less on the |
This proposal is really good and is in line with my current thinking on the matter as well. I'm going to speak with some folks who have more context on money formatting as a whole and see if we can come up with something that works well in all cases. Currency is complex and even differs between locales that use the same currency, and some currencies don't use 100 cent subdivisions, etc... so we'll need to be careful to ensure that it all works properly. But you're 100% correct that the current implementation in Dawn is too complex. It's also fragile in the sense that if anything changes with regards to currencies, it's hard-coded, and thus can easily break. |
In addition of those improvements, I came into another issue. When building the input for the price filter, I use the {{cart.currency.symbol}} to prepend the currency symbol: Unfortunately, for some languages like French, currency code should be after, so it would make more sense to build it like this: But this is impossible for us to know as it depends on the active locale, and we can't hardcode this at theme level. I therefore suggest the following improvement by adding a new {{filter.currency_prefix}} and {{filter.currency_suffix}} drops. Shopify would automatically make one or the other blank depending on the active locale, which would allow us to build a locale-aware price filter. |
Just adding a little more context to this old ticket, since it caused us support debt today. A merchant using RON (in the comma-separated list) contacted us as they are using period-separated decimals on their store (they said this was for an affiliate integration). It may be an edge-case, but editing theme code to remove RON from the hard-coded list of comma-sep currencies was the only way to make the price filter work correctly on their store - in our theme, and also in Dawn. |
Would like to mention https://github.com/Shopify/theme-updates/issues/164 here.
This makes price formatting difficult to handle or predict. 'money' seems to magically select a currency-specific format, but 'money_without_currency' uses the format in the currency settings. |
Bot-B04L4P01WBU [2023-06-04 05:32PM UTC] 🧵 Slack Thread
Created originally at 2023-06-04 05:38PM UTC by Adriane Bugayong |
Hey team, we've received a new report of this behaviour found on the merchant's storefront. Currency is Hungarian Forints (HUF) and inspecting the price filter fields confirms the max values are being replaced with decimal point conversions. eg Interestingly the Edit: Merchant has confirmed the drawer layout works correctly and is currently using it as a workaround. |
Just wanted to share that we are now using this:
With output like this:
And we haven't received any support tickets about price filter for a while. I discovered that Dawn does not currently handle Kr. |
Hi team, have a merchant experiencing this issue when attempting to filter by price on their storefront collections. Currency is set to Chilean Pesos (CLP), and when attempting to enter a price option, the filter is defaulting to display a different minimum amount than what's manually entered. Internal |
Hey team, another ticket with this issue on Refresh 12 and replicated on other themes. Currency is set to COP Colombian Peso. When entering price option the filter can display a different amount and products are not appearing once filtered. |
Hi team! I hope you're doing well. Got another merchant who reported that when filtering the prices, the max price defaults to More details of the investigation here
|
@milan3015809 et al , while this should be a liquid issue, I've noticed people are showing that they are only checking with devtools for the computed DOM. Meaning: |
Hi @PaulNewton Thank you for the feedback. I tried viewing the HTML source while the price filter was set to 100 and it defaulted to 5.790, though I'm not entirely sure how to interpret this. |
I have a pull request up that should resolve this issue, as well as other issues around different currency formats in filters: #3280 |
Interpret it as you knew it was a bug. It's just the DOM gets more and more misleading for bugs involved with complicated features: currency + filters. If you mean interpret the code itself , the placeholder's value is the filter range_max property value *A crude example of a filter price javascript customization is monkey patching the frontend to suppress the prices of high cost products, free products, or specific products, or decimal-to-comma conversion etc. |
Describe the current behavior
Store setup:
Use Euros, set money format to "€{{amount_with_comma_separator}}", on a store with products containing prices in the thousands.
The price range filter inputs do not contain correct values.
See max/placeholder here:
Referring to the code here: https://github.com/Shopify/dawn/blob/main/sections/main-collection-product-grid.liquid#L147
placeholder="{{ filter.range_max | money_without_currency | replace: ',', '' }}"
This goes: 2836.10 -> "2.836,10" -> "2.83610"
Describe the expected behavior
The output should be
placeholder="2836.10"
Version information (Dawn, browsers and operating systems)
Possible solution
The ideal solution would be for Shopify to handle this conversion, perhaps like this:
placeholder="{{ filter.range_max | money_to_input_value }}"
Additional context/screenshots
In my opinion the logic is far too complex for theme code. I don't think it's reasonable to expect a theme developer to be aware of the nuances of all currencies and their delimiters, whether or not they have 0/2/3 decimal places, to know what is going to be output by the current shop.money_format formatting, and when to check against cart.currency.iso_code instead.
All of these appear to factor into this conversion, and I've yet to see an example that does this correctly.
Locking this logic down to the the state of the world in July 2021 also seems like an odd choice to me.
The text was updated successfully, but these errors were encountered: