2022 Developer Survey is open! Take survey.
61 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 ...
user avatar
  • 9,512
33 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 --...
user avatar
23 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 ...
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....
user avatar
  • 2,152
14 votes
Accepted

Auto update cart quantity when change quantity

First edit the cart template /app/design/frontend/{package}/{theme}/template/checkout/cart.phtml and add an id on the form element for easier access. Let's say you add 'id="cart-form"'; Now edit the ...
user avatar
  • 195k
13 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 ...
user avatar
  • 891
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\...
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:...
user avatar
  • 34.1k
12 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"&...
user avatar
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=...
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, ...
user avatar
7 votes
Accepted

Cannot update quantity from cart

you have to include the form key,in cart.phtml. <form method="post" action="<?php echo $this->getBaseUrl('checkout/cart/updatePost')?>"> <input type="hidden" name="form_key"...
user avatar
  • 3,911
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 ...
user avatar
  • 5,848
6 votes

Auto update cart quantity when change quantity

Assuming your site has jQuery included in no-conflict mode, here's a way of doing this asynchronously (much less annoying!). jQuery(document).ready(function(){ jQuery('#shopping-cart-table') .on( ...
user avatar
6 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 = $...
user avatar
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
user avatar
  • 34.1k
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
user avatar
  • 1,028
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 --> ...
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 $...
user avatar
  • 345
5 votes

Product QTY Increment Magento 1.8

Peter, you're trying to use wrong functionality. Quantity increments are meant to be used in cases where you absolutely have to sell something that can't be sold separately, such as six beers in a ...
user avatar
  • 3,405
5 votes
Accepted

changing default quantity of magento's grouped product from 0 to 1

Edit the group product >> on edit page, in the left bar click on “Associated Products” and change the “Default Quantity” values for them.
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 ...
user avatar
4 votes

Items don't turn out of stock when qty is 0

Check your system configuration for values set at different store/website levels that might override your global settings. Check your individual products for configuration that might override your ...
user avatar
  • 43.5k
4 votes
Accepted

Automatically set product "in stock" after credit memo

I found an extension that fixes this issue. Seems to work also with 1.9.x editions when tested. https://github.com/gsafcik/StockAvailability
user avatar
  • 1,461
4 votes
Accepted

Event to observe invoice creation and get the invoiced item quantities

James As you want you works in on invoice creation time you can use getOrigData('entity_id') On creation on invoice it always give the null value and you can use sales_order_invoice_save_after ...
user avatar
  • 75.5k
4 votes

Disable tier pricing when applying coupon code

There is no way to do this in standard Magento. First off, coupons can be added after the product is added to cart (with the discount from tier pricing already in place). You will have to revert it ...
user avatar
4 votes
Accepted

get the quantity of product by code

You can get the product qty by following code. <?php $product = Mage::getModel('catalog/product')->load($products->getId()); echo $product->getSku(); /* To get stock qty */ ...
user avatar
4 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 ...
user avatar
  • 37.4k
4 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 ...
user avatar
  • 14.6k
4 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 ...
user avatar

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