63 votes
Accepted

How to get stock quantity of each product in Magento 2

Solution:1 Create Helper file Stock.php in your module <?php namespace {VendorName}\{ModuleName}\Helper; class Stock extends \Magento\Framework\App\Helper\AbstractHelper { /** * @var ...
Abdul's user avatar
  • 9,692
34 votes
Accepted

Change standard quantity on product page from 0 to 1 (Magento 2)

--The easiest way is that we can change the input value from template: (override this template - not recommend) vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml --...
Khoa TruongDinh's user avatar
26 votes

How to get stock quantity of each product in Magento 2

Like some comments have mentioned, you want to use dependency injection. Do not use the object manager; in other words, do not do what any of the other responses state. The following technique can be ...
danemacmillan's user avatar
22 votes
Accepted

Salable Quantity is showing zero in product grid magento 2?

In DataBase, There was two type, Tables Views The issue is possibly caused when Import/Export DataBase Views was not created in Magento 2.3. So create Views and inventory_stock_1 table in DataBase....
Savan Patel's user avatar
  • 2,318
17 votes

Salable Quantity is showing zero in product grid magento 2?

I'm gonna share my experience related to this issue, I hope it could help someone who would have been in the same situation. We were working on a staged instance, All was ready to go to production. So ...
rou6e's user avatar
  • 1,021
14 votes
Accepted

Can't check requested quantity for products without Source Items support issue on 2.3.1

New code from Magento 2.3 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/product_types.xsd"&...
Shahanas K V's user avatar
12 votes

How to get stock quantity of each product in Magento 2

How to get stock quantity of each product in Magento 2 for controller or block inject \Magento\CatalogInventory\Api\StockStateInterface public function __construct( \Magento\CatalogInventory\...
Surendra Kumar Ahir's user avatar
12 votes
Accepted

Magento2 : Remove decimal from quantity

This decimal comes from database. So if you need to remove this, then you need to create column renderer. Here is an example In your etc/module.xml file add sequence tag follows: <config xmlns:...
Sohel Rana's user avatar
  • 35.6k
11 votes

Salable Quantity is showing zero in product grid magento 2?

I skipped this line of query, due to Previllages error and my add to cart was not working on live server, in local server this line was not skipped and add to cart was working fine. CREATE ALGORITHM=...
Sanaullah Ahmad's user avatar
9 votes

CE 1.9.2.2 - Changing quantity to ZERO in product page should remove the product from cart

This page, is not the product page, its actually a special page used to adjust a product, notice the URL for example in this its product ID 5 checkout/cart/configure/id/5/ That is a custom page, ...
RussellAlbin's user avatar
7 votes

How to get stock quantity of each product in Magento 2

The below script will be helpful to get the product stock qty, min qty and stock details in magento2. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $productStockObj = $...
Tapas Ranjan's user avatar
7 votes
Accepted

Magento 2 stock inventory is not being updated

Check below settings. Admin > Store > Configuration > Catalog > Inventory > Stock option > Decrease Stock When Order is Placed Set it to yes. If you have a multi-website or multi-store then change ...
Chirag Patel's user avatar
  • 6,106
6 votes

Magento 2 - How to set a maximum order qty of individual products?

For Magento 2.1.x Goto Admin -> Stores -> Configuration For individual settings, go to product details Click Advanced Inventory
Sohel Rana's user avatar
  • 35.6k
6 votes

Magento 2 stock inventory is not being updated

check your stock setting in admin panel Advance Inventory->manage stock set to yes if you want to reduce quantity
Tirth Patel's user avatar
  • 1,039
6 votes
Accepted

how to add quantity increment and decreament (+ and - button) in minicart magento 2?

app/design/frontend/Module/theme/Magento_Checkout/web/template/minicart/item/default.html <div class="product-item-pricing"> <!-- ko if: canApplyMsrp --> ...
Hitesh Balpande's user avatar
6 votes
Accepted

How to set qty to product on MSI Magento 2.3

Here you go! /** * @var Magento\InventoryApi\Api\SourceItemsSaveInterface */ protected $sourceItemsSave; /** * @var Magento\InventoryApi\Api\Data\SourceItemInterfaceFactory */ protected $...
Sondre's user avatar
  • 343
5 votes

Database table for price/quantity (tier prices)?

The tier prices are stored in the catalog_product_entity_tier_price table. There is also an index table of the tier prices (catalog_product_index_tier_price) which contains aggregated data from the ...
Sander Mangel's user avatar
5 votes

Change standard quantity on product page from 0 to 1 (Magento 2)

Khoa's second option is the preferred one. Anyways, this sometimes does not work for bundles. There you have to also carefully check the bundles option's and quantities. The logic for the default ...
Alex's user avatar
  • 13.7k
5 votes

Change standard quantity on product page from 0 to 1 (Magento 2)

--The second way is the Magento default config: STORES > Configuration > Catalog > Inventory > Product Stock Options > Minimum Qty Allowed in Shopping Cart > > Add Customer Group > change to 1 For ...
Rebecca Brocton's user avatar
5 votes
Accepted

Qty Uses Decimals Magento 2 does not work

Go to Catalog > Product > Advanced Inventory Change value of Minimum Qty Allowed in Shopping Cart this Option in Decimal Points [For ex 0.25] or anything minimum quantity you want to add into ...
Emipro Technologies Pvt. Ltd.'s user avatar
5 votes
Accepted

Error message "Some of the products are disabled" on checkout

check your magento file vendor/magento/module-checkout/Model/GuestPaymentInformationManagement.php the GuestPaymentInformationManagement.php file is updated in magento2.4.4 version. Magento\Checkout\...
S.P's user avatar
  • 1,524
4 votes
Accepted

How to show Qty left in Magento 2 Listing page?

Create a block class to your custom module named Vendor_Module to below path: app/code/Vendor/Module/Block/Product.php and add the below content to it: <?php namespace Vendor\Module\Block; ...
Sukumar Gorai's user avatar
4 votes

Store level Inventory for individual product Magento 2.2.0

Untill magento 2.2.6 you can not assign / allocate inventory on store level or website level basis. inventory is managed globaly so you will have single inventory across all stores / websites. ...
Naveed Asim's user avatar
  • 3,607
4 votes

Salable Quantity is showing zero in product grid magento 2?

I had to remove the DEFINER=root@localhost from @Thakur answer so here is what I used: CREATE ALGORITHM=UNDEFINED SQL SECURITY INVOKER VIEW `inventory_stock_1` AS select distinct `...
The Billionaire Guy's user avatar
4 votes

Salable Quantity is greater than quantity

Based on your description the root cause of the problem could be one of those: You have upgraded to Magento 2.3 from the previous version of Magento where you had some orders placed, but not shipped. ...
Igor Minyaylo's user avatar
4 votes
Accepted

Load Product Qty by sku in Magento 2 Controller

First load product by sku: $product = $this->_productRepository->get($sku); To get stock qty use this: $StockState->getStockQty($product->getId(), $product->getStore()->...
Shoaib Munir's user avatar
  • 9,344
4 votes
Accepted

How to update product salable quantity in Magento 2.4 programmatically?

To set the saleable quantity of a product , you need to look at this table = "cataloginventory_stock_item" , in this the field = "qty". So in order to set the qty in this table , ...
Bharath Kumar's user avatar
3 votes

How to get stock quantity of each product in Magento 2

If you want to $productobj after saving product from backend side so you can easily use catalog_product_save_after event. I am assuming that you already know how to create a module in M2. Right now ...
Baharuni Asif's user avatar
3 votes

Create a product with different colors (associated products) where each color shares stock with all other colors

As Thorsten said You won't be able to achieve this with Magento's current default functionality. However, I have found the solution to this problem using a third-party extension. This extension allows ...
Prashant Singh's user avatar
3 votes

Quantity increment button

Here I am guiding you adding plus/minus functionality with increment of 100 in default file. Use the code accordingly. In catalog module edit your Quantity function which comes by default in ...
Manoj Deswal's user avatar
  • 5,765

Only top scored, non community-wiki answers of a minimum length are eligible