Hello,
We're using Product Levels on a brewery website where bottles can be purchased singly (SINGLE BOTTLE) or in packs of 12 with a discount (MULTIPACK).
We've implemented a single Bottled Beer Product Part.
The SINGLE BOTTLE product and MULTIPACK product both have BOM links to the Bottled Beer Product Part with quantities 1 and 12 respectively.
If we set the stock quantity of the Bottled Beer Product Part to 11 we see that the calculated stock for the BOM parents are:
- SINGLE: 11
- MULTIPACK: 1
The calculated stock for the MULTIPACK is incorrect for our needs. It is rounding the calculated stock from 11/12 to 12, when we really need to to round down to 0.
I can't see any settings to control this behaviour.
Digging into the code I can see the calculation performed in Helpers:get_calculated_stock_quantity line 691:
$calculated_array[ $bom_id ] = $boms_stock['bom_stock'][ $bom_id ] / $qty;
Can the above line be changed to have behaviour similar to:
$calculated_array[ $bom_id ] = floor($boms_stock['bom_stock'][ $bom_id ] / $qty);
Any advice on how to handle calculating stock when fractions of a product are not permitted?
Thanks,
Dan.