Merge pull request #474 from jitendra-webkul/jitendra
Inventory issue fix
This commit is contained in:
commit
e7c5c373e2
|
|
@ -29,6 +29,9 @@ class ShipmentItemRepository extends Repository
|
|||
*/
|
||||
public function updateProductInventory($data)
|
||||
{
|
||||
if (! $data['product'])
|
||||
return;
|
||||
|
||||
$orderedInventory = $data['product']->ordered_inventories()
|
||||
->where('channel_id', $data['shipment']->order->channel->id)
|
||||
->first();
|
||||
|
|
@ -54,6 +57,9 @@ class ShipmentItemRepository extends Repository
|
|||
->where('inventory_source_id', $data['shipment']->inventory_source_id)
|
||||
->first();
|
||||
|
||||
if (!$inventory)
|
||||
return;
|
||||
|
||||
if (($qty = $inventory->qty - $data['qty']) < 0) {
|
||||
$qty = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue