CalculateOrderLineUnitPrice is the correct newer method, but I'm not sure I understand what you mean that you can't change the price? Yes, Price objects are immutable, but the job of CalculateOrderLineUnitPrice is to return the calculated price so you can return your own instance of a Price object with a different value to have it override the Price.
return new Price(valueWithoutTax, taxAmount, currencyId);
Or, if you want it to automatically calculate the tax amount for you from the passed in tax rate
In Vendr is there a way to Calculate product price when adding to Basket?
In TC i use:
Within :
To calculate the price of a product when adding to the basket. Can this be done in Vendr similarly?
I'm using :
But as these are ReadOnly I cant effectively change the Price when it gets added to the basket.
The product has a Base Price, and then properties sent along with the product in the orderLine will be then calculated before adding it to the basket.
So for instance the product is 20sm in size @ 12.00 per 2m, I'd need to calculate that when adding to the basket for this particular product.
Is there any way of doing that in Vendr?
Hi Neil,
CalculateOrderLineUnitPrice
is the correct newer method, but I'm not sure I understand what you mean that you can't change the price? Yes, Price objects are immutable, but the job ofCalculateOrderLineUnitPrice
is to return the calculated price so you can return your own instance of a Price object with a different value to have it override the Price.Or, if you want it to automatically calculate the tax amount for you from the passed in tax rate
/Matt
Ah yes, sorry see what you mean. Sorry, it's been a long day.
Great stuff, I can calc the price given by properties.
Thanks, Matt.
I know the feeling well. Glad I could help never the less 👍
is working on a reply...