We have a setup where we sell cupon codes with a amount of time. You can buy 1 year or 3 months. Payment is made with cash at conferences and at a webshop. (This is manual done and we will continue with this.)
I have setup a fixed plan with the price: 0, expiration time: 1 day.
I made a cupon code, type: "Subscription Extension", extend time: 1 year.
When I try to purchase this plan with the cupon code, i get the following error: "Maximum allowed discount crossed, so only allowable discount applied"
The troubles is in the last if statement, because: $existingDiscounts = "0.00" and $allowedAmount = float(0).
public function checkForUpperLimit(&$newModifier, $invoice)
{
$subTotal = $invoice->getSubtotal();
$discountable = $invoice->getDiscountable();
$actualTotal = $subTotal + $discountable;
$maxDiscount = (float) $this->config->get('allowedMaxPercentDiscount');
$allowedAmount = ($maxDiscount * $actualTotal) / 100;
$existingDiscounts = $invoice->getDiscount();
// If existing discount is already greater or equal to max allowed
if ($existingDiscounts >= $allowedAmount) {
return false;
}
[...]
Discount is set to 100% in the global settings.
Is my approach wrong or could we make a fix?
Thanks in advance!