Sylius / ShopApiPlugin

Shop API for Sylius.
https://sylius.com
129 stars 89 forks source link

Discount amount calculated in percentage product discount is 1000 times bigger than it should #645

Open Bizkaitarra opened 4 years ago

Bizkaitarra commented 4 years ago

Sylius version affected: 1.6.4

Description
I'm making a promotion of 50% in product. Promotions with fixed discount in product works ok but percentage discount in product calculates wrong the amount to discount. I debug and see that it gets a discount 1000 times bigger than it should and thats why the product price results negative and Sylius returns 0.

Steps to reproduce
Create a promotion with discount in product. Create a cart with the afected products. Get the cart with Sylius API using ShopAPI.

Possible Solution
I'll fix it by dividing the amount of the discount with 1000 but I don't know if it could be better solution

lchrusciel commented 4 years ago

I'm right, that your issue is more related to ShopAPI? Can you provide more details about your issue?

Have you already asked for on our #support channel on Slack?

Bizkaitarra commented 4 years ago

I have debug when I make ShopAPI petition and the 1000 bigger result gets in UnitPercentageDiscountPromotionActionCommand class in line 76.

I haven't ask this in a separated conversation in slack so I think it has not been readed. I'll do it

mamazu commented 4 years ago

Sounds like a bug indeed.

mamazu commented 4 years ago

I have played around with the percent discount of an item and I couldn't find anything wrong with it.