How to Auto Change “Stock Availability” on Quantity Update in Magento 2

How to Auto Change "Stock Availability" on Quantity Update in Magento 2

Finding it difficult to manage the inventory status in your Magento 2 store? Do you sometimes forget to update the stock availability status after changing the quantity number in the Magento 2 backend? Ever disappointed a visitor with out of stock status which was not the case actually?

I get you! 😄

Developers tend to forget the inventory status after updating the quantity. This results in out of stock status in the frontend although you have updated the stock from the backend.

How about implementing a method that auto change “Stock Availability” on quantity update in Magento 2? In that way, you don’t need to worry about the inventory status. The code below takes care of it!

Steps to Auto Change “Stock Availability” on Quantity Update in Magento 2:

  1. Create observer catalog_product_save_after in Vendor > Extension > etc > adminhtml > events.xml
  2. Create observer file

Follow the above steps and you can easily manage the inventory status on quantity change in Magento 2!

Please feel free to post any doubts on the topic in the Comments section below and I’d be happy to help.

Do rate the post with 5 stars!

Thank you.

5
(based on 9 Reviews)

Sanjay is a co-founder at Meetanshi. He is a certified Magento developer who loves creating Magento E-commerce solutions. When he is not engrossed with anything related to Magento, he loves to play cricket.

2 comments On How to Auto Change “Stock Availability” on Quantity Update in Magento 2

Leave a Reply

%d bloggers like this: