Currently trying to get the total price of an order with symbol. I've got the OrderReadOnly model using the order service which has the total price but just as a decimal.
Yea, I'd recommend always having that using statement when using the Vendr API as there are a few things that are available via extension methods that all become available when you have that added.
Getting Price from Order with Currency
Hi,
Currently trying to get the total price of an order with symbol. I've got the OrderReadOnly model using the order service which has the total price but just as a decimal.
I'm currently hardcoding this:
Now, obviously there is a better way than this abomination so what's the easiest way to get the total price but with currency symbol?
Thanks,
Ben
Hey Ben,
You can use the
Formatted()
extension on TotalPrice.Value to convert it into it's formatted form.This will return the price values formatted for its relevant currency.
You'll need to make sure you have a
using Vendr.Core
statement to have access to the formatted extension method.Hope this helps
/Matt
Ah,
using Vendr.Core
was indeed what I was missing there, works a charm. I knew you'd have this covered!Excellent 😁
Yea, I'd recommend always having that using statement when using the Vendr API as there are a few things that are available via extension methods that all become available when you have that added.
Glad we got it working 👍
/Matt
In more recent versions of Vendr, this extension is found
using Vendr.Extensions
is working on a reply...