wearepixel / laravel-cart

MIT License
5 stars 1 forks source link

Cart total always equal to subtotal when conditions on the total bring the total down to 0 #19

Closed joelwmale closed 1 month ago

joelwmale commented 1 month ago
        $conditionsForTotal->each(function (CartCondition $condition) use ($subTotal, &$total) {
            $toBeCalculated = $total > 0 ? $total : $subTotal;

            $total = $condition->applyCondition($toBeCalculated);
        });

This code always says to use $total if it's above 0, so if it's never above $0, it will always use the subtotal. This causes weird interactions when a discount applied to the total brings it to $0.