resolve issue of downloadable product when it gets cancelled #5663

This commit is contained in:
Akhtar Khan 2022-01-25 10:47:31 +05:30
parent abcc1f1aad
commit 33b422b29c
1 changed files with 3 additions and 0 deletions

View File

@ -106,6 +106,9 @@ class DownloadableLinkPurchasedRepository extends Repository
$totalInvoiceQty = $totalInvoiceQty + $invoice_item->qty;
}
$orderedQty = $purchasedLink->order_item->qty_ordered;
$totalInvoiceQty = $totalInvoiceQty * ($purchasedLink->download_bought / $orderedQty);
$this->update([
'status' => $purchasedLink->download_used == $totalInvoiceQty ? $status : $purchasedLink->status,
'download_canceled' => $purchasedLink->download_bought - $totalInvoiceQty,