I want to remove/hide the decimal places for price from all the collection pages and grid galleries on homepage.
By default the product price should be visible as an integer.
So use Math.trunc(price)
I get that we can use the above function but where should the change be made so that the Prices in the Entire Store are shown as Integer.
@gawatekarishma You can try to create an afterQuery and an afterGet hooks for the relevant database collection.
inside the hook handler put:
//backend/data.js
export function Stores$Products_afterQuery(item, context) {
item.price = Math.trunc(item.price);
item.formattedPrice = item.price + item.currency //or format s you wish ;
return item;
}
This should work if you build a full custom store. I don’t know if it’ll work for the Stores app as many apps skip the hooks.
J. D.: Hello, I’m trying to implement the Code on my site, but I’m having trouble doing it. What do I have to write below Sortes$Productos_afterGet? Thank you.
It is very sad and disappointing to know the bitter fact, that still even after years, there is NO SOLUTION to the issue of REMOVING THOSE EXTRA DECIMALS (.00) from the product prices in Wix store! Why the Wix team is not providing the option to hide those extra decimal points after the integers, which is really making the product price look so ugly and bulky? There are still so many Wix users who want to do the same but unfortunately still there is no official solution provided for this issue, to provide the option to do such!
Has wix already added a relevant function? I have tons of products its is so sad