Product Inventory shows out of stock. If the stock is present in the database.
-
Hi
I'm updating the
product inventory
from API using product id. So I was updating manually like thisProductInventory::where('product_id', $product->product_id) ->where('inventory_source_id', 1) ->update(['qty' => 10]);
After this I can see the update in dashboard and database. But in frontend it is showing
out of stock
. After debugging I came to know this function is returning0
qty.public function haveSufficientQuantity($qty) { return $this->getTypeInstance()->haveSufficientQuantity($qty); }
I'm new to bagisto but i'm not understanding what is wrong.
Thank you
-
@matheen said in Product Inventory shows out of stock. If the stock is present in the database.:
->where('inventory_source_id', 1)
->update(['qty' => 10]);Hi there,
Please take a reference from Here
I guess you skip some steps while creating method for update inventory. -
@sanjay-webkul Can you tell me where I can find this function
haveSufficientQuantity
. Just to check how it is been calculated? Because everytime It's returning0
from the function. -
@matheen said in Product Inventory shows out of stock. If the stock is present in the database.:
haveSufficientQuantity
Hi there,
Please find the haveSufficientQuantity() function here