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
we are currently evaluating Vendr for a shop implementation.
Our more or less single "pain-point" is that Vendr is calculating prices based on the property on the actual product. In our use-case the product price is calculated based on values the customer provides. These values will get send to an API which then returns the price.
In our case these are two dates, the selected product and some additional information.
Is it possible to set a fixed price when a product is added to the cart and disable all calculation based on the product node?
I'm pretty sure you can. I think you can create your own ProductCalculator which is responsible for calculating the prices of an order line.
You might need a "OrderLineCalculator" though
Nik is pretty close but the IProductCalculator is only used when you ask a ProductSnapshot to calculate a price, which usually only occurs when you want to display the product price on a product page.
What you would want to use is an IOrderLineCalculator as this is used for calculating the price on an order line during order calculation, ie, after the item is added to the order.
There are two approaches you could take here:
The two are essentially the same, it just depends where you want to put your calculation logic.
Hope this helps
sorry for the late response, needed some time to test it all out. :)
We decided to go with the property and custom OrderLineCalculator which works like a charm.
Setting the property: order.WithOrderLine(orderLine.Id).SetProperty("apiPrice", "15");
var apiPriceReturn = orderLine.Properties["apiPrice"].Value;
return base.CalculateOrderLineUnitPrice(order, orderLine, currencyId, taxRate);
var priceDecimal = Convert.ToDecimal(apiPriceReturn);
return Price.Calculate(priceDecimal, taxRate, currencyId);
Thanks for the help!
And thanks for sharing your working code. I’m sure that’ll come in real handy for others wishing to do similar 🙌🏻
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted