Hello, MageComp Folks,

Today we are going to learn how to set custom default qty. when creating a new product in Magento 2.3. It is a commonly known issue in default Magento.

When you create a new product in default Magento, the qty. of the product is set to 0 which is not good at all because when consumers visit the product page, they think that the product qty is 0 and leave the page without ordering. But the good news is that you can set the custom qty of any number you like when creating a new product in Magento itself with little bit of coding knowledge.

Follow the steps described below to set the custom default qty when creating a new product in Magento2.3.

First thing you want to do is to create a file app\code\Vendor\Extension\etc\adminhtml\di.xml

Once the file is created then use the below code to modify default qty

If your store has multiple vendors then follow the above step for every vendor.

Now when the above step is complete then create a file, app\code\Vendor\Extension\Ui\DataProvider\Product\Form\Modifier\DefaultQtyModifier.php

Now when the file is created then use the below code to set the custom default qty for new product as any number you like

Here, instead of 25, you can define your custom qty number and you can set different custom qty for different user groups. For wholesale users, the qty can be set as 50 or 100.

So, in this article, you have learned how to set the custom default qty in when creating a new product in default Magento 2.3. Using the codes described you are able to set the qty as any number you like.

Lastly, if you found this blog helpful, don’t forget to share it with your colleagues and Magento Friends and Let us know if you are facing any issue while implementing this code.

Thanks and Happy Coding ?

 

Click to rate this post!
[Total: 5 Average: 5]