Skip to content
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

gpcp-product-pricing-labels.js: Fixed an issue with decimal comma prices. #998

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

saifsultanc
Copy link
Contributor

Context

⛑️ Ticket(s): https://secure.helpscout.net/conversation/2816007580/76520

Summary

Snippet is incorrectly handling values containing non-zero values after the comma for prices in Euros.

Steps to reproduce:

  1. Steps to Reproduce
  2. Set default currency in Gravity Forms to Euros.
  3. Create a basic form (I included my export).
  4. Add a product field. Set field type to drop down.
  5. Add demo choices with varying prices. Make sure to include some that have nonzero numbers after the comma (e.g. 7,50)
  6. Add this JS snippet. Needs this PHP counterpart
  7. Preview form

FORM SETUP:
Screenshot 2025-01-13 at 4 54 16 PM

BEFORE:
Screenshot 2025-01-13 at 4 54 24 PM

AFTER:
Screenshot 2025-01-13 at 4 54 35 PM

The snippet uses the Gravity Forms method gformFormatMoney, which is defined as : function gformFormatMoney(text, isNumeric){. The gformFormatMoney relies on currency.toMoney(text, isNumeric).

Current logic we have does not define isNumeric as true when calling gformFormatMoney which causes the formatting issue with decimal comma currency values.

@saifsultanc saifsultanc added the bug Something isn't working label Jan 13, 2025
@saifsultanc saifsultanc merged commit ed8d79c into master Jan 14, 2025
4 checks passed
@saifsultanc saifsultanc deleted the saif/fix/76520-fix-euro branch January 14, 2025 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants