yii2-cart icon indicating copy to clipboard operation
yii2-cart copied to clipboard

Unable to have a float/decimal value in Cart item price

Open lumikcz opened this issue 6 years ago • 1 comments

The CartItemInterface.php uses int data type for price value:

public function getPrice(): int;

I believe that more correct would be to have this value float/double to support decimal values in prices. In version <1.4 it was originally untyped function, so it was no problem.

I propose changing the signature to float.

lumikcz avatar Mar 26 '19 14:03 lumikcz

Yes, I agree with this. It is not clear why getPrice() must return an integer.

How is it supposed to work with an item that costs 0.5€ or 0.25$ ?

Slayvin avatar Jan 19 '21 11:01 Slayvin