Negative values as Price

Hi,
In our project, we recently updated Litium from version 5.5.1 to 5.6.4. But after this, while trying to import products and variants, the variants with negative values as prices are not getting imported/saved. In the import report, i am getting the following message ‘Exception: Prices[0].Price: Negativt värde är inte tillåtet. Prices[5].Price: Negativt värde är inte tillåtet.’. Tried updating the negative prices manually through the Litium UI, and still getting the same message. Any work around/ ideas ?

Litium version: 5.6.4

It’s not possible to have a price for a product that is negative, that is what the error message is saying.

What is the business case when you need to give the customer money when they buy the product?

1 Like

Thank you for your response.

Our requirement is such that we charge an amount for a service(along with some default products). These product’s price is zero. And then we give an option to the user so that he can select some low cost products instead of the default products. So there arises the need for negetive values.

For instance
Service Price = 300.
Default Products price = 0.
So Service + Free default products= 300
If user opts for low cost products, then the price should be 200.
Low cost products price = -100.

There are many varieties of low cost products, so we cant really use discounts here.

I have little hard to get the full picture about the requirement but it sounds strange to have products with negative prices. What will happen if the customer put the “low cost product” i the cart?

I think this should be setup with either campaign, packages or as an own price calculator.

If we making a special campaign action that will find this service fee and using that as a reduce price for the included products. Then we gen get below scenarios out of the box and the same product/replacement product can also be related to the service.

If product price is more than or equal the service fee [service fee] + ([product price] - [service fee]) and if the product price is less than the service fee we instead have the [service fee] - ([service fee] - [product price]). then we can have both low cost product and premium product as replacement for the standard and the premium will instead will add an additional charge.

They you don’t have to manage all the different prices for all of the different combinations, only the service price and the price for the products and a relations between the products that should be possible replacement products.

Is it possible to explain the business requirement a little more please?

The negative values are not allowed from following validation rules, that can be excluded using your web.config.
https://docs.litium.com/documentation/get-started/web_config#plugins

to allow negative prices you need to add following:
<remove type=“Litium.Application.Products.ValidationRules.PriceListRulePriceItemPrice, Litium.Application”/>

<remove type=“Litium.Application.Products.ValidationRules.VariantRulePriceItemPrice, Litium.Application”/>

That will cause Litium API to not to take those rules into consideration.

Note that, we have not tested our calculations (order total and campaigns), with negative values. But since this has being working for you before we do not expect anything to fail.
Still it is very important to test properly.