Price from custom ProductCalculator is not the productprice when added to cart. #723
niekvanderreest
started this conversation in
Ideas
Replies: 1 comment
-
I'm going to move this to a feature request as currently this is just how it works, ie Product Calculator calculates the prices of a product before it is added to cart, but the Order Line Calculator calculates the orderline when a product is in the cart. However I do think this is a really good idea and makes a lot of sense for the OL Calculator to fallback to the Product Calculator. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Which component is this issue related to?
Umbraco Commerce (Core)
Which Umbraco Commerce version are you using? (Please write the exact version, example: 10.1.0)
15.3.5
Bug summary
When overriding the default ProductCalculator, the price from this calculator will not be the price when adding a product to an order.
Specifics
I've added a custom implementation of the ProductCalculator and registered at startup it in the umbraco commerce pipeline using AddUmbracoCommerce(builder => ..) I need this because my store maintains different prices for registered, paying (and logged in) members as for non-members, thus i have a price and a memberprice property defined for products.
I'd expect the ProductCalculator to be used for ALL prices from now on, but when adding a product to an order in my CartSurfaceController this results in the default price of my product.
I've worked around this by also implementeing a custom OrderLineCalculator and overriding TryCalculateOrderLineUnitPriceAsync with pretty much the same logic as on the ProductCalulator, I wouldn't think this is needed.
Steps to reproduce
Extend your product with a memberprice property (umbraco commerce price property editor) suply 2 different prices, create and regiter a custom ProductCalculator and get the price from the memberprice field.
Note how displayoing prices with the CalculatePriceAsync() function shows the correct price (memberprice), where as adding that product to your order adds the value from the price property in Umbraco.
Expected result / actual result
ProductCalculator is in my opinion on a "lower" level than orderline or order calculation, and these services should default to using the registered ProductCalculator when calculating prices
Dependencies
Umbraco 15.4.2
Umbraco Commerce 15.3.5
Beta Was this translation helpful? Give feedback.
All reactions