Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Product Inventory shows out of stock. If the stock is present in the database.

    General Discussion
    2
    4
    337
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      matheen last edited by

      Hi

      I'm updating the product inventory from API using product id. So I was updating manually like this

       ProductInventory::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 returning 0 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

      1 Reply Last reply Reply Quote 0
      • sanjay-webkul
        sanjay-webkul last edited by

        @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.

        1 Reply Last reply Reply Quote 0
        • M
          matheen last edited by matheen

          @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 returning 0 from the function.

          1 Reply Last reply Reply Quote 0
          • sanjay-webkul
            sanjay-webkul last edited by

            @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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post