Redeem Now
Read More
Read now
Menu Close
    Start a Project Request quote Reading list Switch to dark mode

    Update product stock programmatically in magento2

    Here we learn how to update product stock programmatically in magento2

    Here we define function in helper file of module

    Thanks 🙂

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


  • Fabio Bozzo
    why do you save $product too?
  • Marc
    Can this be used with a .csv file containing “sku”,”price” ? Thanks! 🙂
  • Alex
    got it
    $item[‘product_id’] is product is

    Thanks for this post

  • Alex
    please let me know what is ‘$item’ here?
  • Jacco Amersfoort
    It doesn’t work for me. Adding ” MagentoCatalogInventoryApiStockStateInterface $stockStateInterface,” to the constructur parameters gives me the error “Argument 2 should be StockStateInterface, none given”. I tried it on a controller. Does it only work on Helpers?
  • Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again