Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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:
target.Cost = "£" + source.TotalPrice.Value.WithTax;
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?
You can use the Formatted() extension on TotalPrice.Value to convert it into it's formatted form.
target.Cost = source.TotalPrice.Value.Formatted().WithTax;
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
Ah, using Vendr.Core was indeed what I was missing there, works a charm. I knew you'd have this covered!
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 👍
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted