Skip to content

Price from custom ProductCalculator is not the productprice when added to cart. #722

@niekvanderreest

Description

@niekvanderreest

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions