3

I need to create a custom product type that has custom stock functionality and does not behave like a simple product, bundle, or configurable.

To build out this product type I need to understand how Magento 2.3 with product category stock filters work (and indexers) and how product types are tied to stock models.

I have tried looking at the Magento Catalog module and can see where category product collection is made but not how it filters for stocks vendor/magento/module-catalog/Block/Product/ListProduct.php:485 and the UML diagram here: https://github.com/magento/inventory/wiki/New-Indexer-for-StockItems as well as how the simple and bundle product types are setup.

So basically when and where does stock checking happen, where are the stock models tied to products, where are the stock checks done when viewing a product category on the front-end, and how can I make my own models for a new product type? Also are indexers used for these checks?

PS are there any UML architectural diagrams for classes and how they interact besides the very high level ones on Magento Docs site?

1

To Manage inventory product type wise you need to create own models and listing block if needed. For inventory.
How the new MSI (Multi Store Inventory) linked to store? If i have three stores 1) English 2) German 3) Indian Three table created (1,2,3 stands for store id of store.)

English : inventory_stock_item_stock_1 
German : inventory_stock_item_stock_2 
Indian : inventory_stock_item_stock_3 

enter image description here

How store linked to products?

cataloginventory_stock_item 

table has all products stock (qty) store wise.

cataloginventory_stock 

table contains store ids.

Now the main thing will come into a focus. Magento 2.3 version introduced a view (not a table) which also same as

inventory_stock_1

as per store it has.

At last remember invetory manages by product id and website(store id) wise so whatever your product type is it save into same table, what you need to perform is to manage your modules, collection of product type, your stock(qty) render on frontend and admin side.

Please let me know if you need to understand more deeply.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.