From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Subtotal cart

Subtotal cart

So we're going to continue on with this cart page and what we want to do now is have a cart over here that has Like the the subtotal and has the button to move on to the next step But I do want to add create a currency formatter so you can easily change the currency from USD to whatever you want And you can just change the style I mean, I don't know why you would change the style to anything but currency currency, but you can have it formatted as percentages or whatever using the international number format method, and you can change your locale as well. So we're going to put this in the utils file, which is libutils.ts, and let's come down here, and first we're just going to create the formatter itself, and I'm going to make this variable name all uppercase, so currency formatter, and we're going to use new and And then intl. and then the number format method. So this just allows us to format the locale and all that. So mine is en-us, but if you're somewhere else, you want to use…

Contents