Stop it from adding ".00" to the price for Japanese Yen

104 views
Skip to first unread message

jesario

unread,
Jan 10, 2021, 10:10:03 AM1/10/21
to Easy!Appointments - Support Group
I am working in Japanese Yen. Is there a way to stop the automatic addition of ".00" to the price beginning in the backend, so that it also shows without it in the frontend?


Jesario

Alex Tselegidis

unread,
Jan 13, 2021, 10:18:37 AM1/13/21
to Easy!Appointments - Support Group
Hello! 

You will need to edit the frontend_book.js file and change price formatting.






  Alex Tselegidis, Easy!Appointments Creator
  Need a customization? Contact me in person!

 

jesario

unread,
Jan 15, 2021, 5:30:26 AM1/15/21
to Easy!Appointments - Support Group
Hi Alex!

Thanks for your attention. I tried editing edit /assets/js/frontend_book.js again to no avail, trying to format service.price and servicePrice. I've even set them to 0 as a test, it runs, but nothing changes.

Could please provide a few more specifics? 

Thanks,
Jesario

Alex Tselegidis

unread,
Jan 19, 2021, 3:52:44 AM1/19/21
to Easy!Appointments - Support Group
I took another look at the code and see that there is no additional formatting for the price, when its being rendered in the booking page: 

if (Number(service.price) > 0) {
  $('<span/>', {
    'text': '[' + EALang.price + ' ' + service.price + ' ' + service.currency + ']'
  })
    .appendTo($serviceDescription);
}

Just make sure that the price is store the way you want them to display from inside the backend services page. 






  Alex Tselegidis, Easy!Appointments Creator
  Need a customization? Contact me in person!



jesario

unread,
Jan 21, 2021, 4:46:35 AM1/21/21
to Easy!Appointments - Support Group
Hi Alex,

Thanks for checking into it!

The backend services page automatically adds ".00" or cents to the number. For example, if you enter "5000" and save it, it will show up as "5000.00" after the save.

For Japanese yen, Korean won, and others - a decimal with cents added is not used.

I was hoping to just add something like Math.trunc() to the variable cut the decimal out, but can't seem to be able to affect the output.

Alex Tselegidis

unread,
Jan 21, 2021, 7:49:11 AM1/21/21
to Easy!Appointments - Support Group
Well, in this case you will need to change the field type in the database from decimal to integer, as this is the fastest way for you to avoid the ".00". 

The other way would be to modify the app to format the payment based on your local formatting, that would need code modifications. 



  Alex Tselegidis, Easy!Appointments Creator
  Need a customization? Contact me in person!



jesario

unread,
Jan 21, 2021, 8:23:40 AM1/21/21
to Easy!Appointments - Support Group
Great idea, thanks that worked!

francisco astorga

unread,
May 11, 2025, 1:27:46 PM5/11/25
to Easy!Appointments - Support Group

This solution no longer works in EasyAppointments 1.5.1.

francisco astorga

unread,
May 11, 2025, 1:56:23 PM5/11/25
to Easy!Appointments - Support Group
  • I found this Solution for Easyappointments version 1.5.1.
    Open assets/js/pages/booking.js.
  • Replace lines 729-732 with:
    <div class="mb-2" ${!Number(service.price) ? 'hidden' : ''}> <i class="fas fa-cash-register me-2"></i> ${new Intl.NumberFormat('es-CL', { style: 'currency', currency: 'CLP', minimumFractionDigits: 0, maximumFractionDigits: 0 }).format(Number(service.price))} </div>
  • Replace lines 935-936 with:
    if (Number(service.price) > 0) { additionalInfoParts.push(`${lang('price')}: ${new Intl.NumberFormat('es-CL', { style: 'currency', currency: 'CLP', minimumFractionDigits: 0, maximumFractionDigits: 0 }).format(Number(service.price))}`); }

Alex Tselegidis

unread,
May 12, 2025, 10:04:51 AM5/12/25
to Easy!Appointments - Support Group
Thanks for sharing your solution!




Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!



Reply all
Reply to author
Forward
0 new messages