Closed solverat closed 7 months ago
Setting $item->setDefaultUnitQuantity(1);
outside the if-clause should be enough.
It is still wrong, but in the gift product action, we don't know which unit definition to choose.
the unit should be choosen in the price rule action, right?
but for now, as a fix we can use the default unit.
@dpfaffenbauer Of course, that would be premium. :) If a product has multiple unit definitions, the action should show them in a dropdown. This would allow us to set $item->setUnitDefinition
and $item->setDefaultUnitQuantity
definitely correct.
Maybe second prio.
Setting the default unit quantity happens here in gift product action https://github.com/coreshop/CoreShop/blob/445201ae696420fdf149d297ca38a969e400e27e/src/CoreShop/Component/Core/Cart/Rule/Action/GiftProductActionProcessor.php#L78-L84
and I guess it should be similar to this: https://github.com/coreshop/CoreShop/blob/445201ae696420fdf149d297ca38a969e400e27e/src/CoreShop/Component/Core/Order/Modifier/CartItemQuantityModifier.php#L51-L55