We need to be able to set custom prices for a variant when added to the cart.
The use case is as following:
Our customer has a setup where their customers can have BID-prices.
A BID-price is a special price just for the customer for one or more products. It’s also just valid for a certain period and for a specific quantity of products.
We’re getting all prices from the customers ERP-system in real time, and we’ve implemented our own PriceCalculator to fetch the list prices and that works as expected.
The issue is that a customer can choose, on the product details page, to buy the product with the BID-price. We’re adding the product to the cart, with some AdditionalInfo, and in a OrderRowFactory we’ll set the BID-price in the row.
That works well , but when a customer changes the quantity in the cart; the list price is selected via the PriceCalculator, and the BID-price is gone.
It would be nice to either be able to pass a custom price to the storefront api when adding or updating a variant, or have some more context in the PriceCalculator about the entity requesting a price.
Another solution would be to be able bypass the PriceCalculator when the quantity has changed. Add a boolean to the mutation so that the price is not fetched again.
You could also solve it by adding a property on the order row that would mark it as a static price that should not be changed. And that would be ignored by the price calculator.