-
Notifications
You must be signed in to change notification settings - Fork 171
MSI compatibility while being backward compatible #1739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thank you for your contribution @thomas-kl1 ! It has been on the roadmap to retire the need for a separate module for MSI since it has long been the default in Magento 2.4. We'll be sure to review and incorporate your proposed changes in an upcoming release! |
This is a quality contribution @thomas-kl1 ! Thank you for taking the time to share this. We have a different intention regarding the core module but while we address that separately your ideas have been incorporated in algolia/algoliasearch-inventory-magento-2#31. |
@cammonro things would be less complicated if the changes I suggest were approved. It's a minimal change for a greater support overall |
Thanks for your thoughts on this. A couple of things:
I also have a concern with your suggested approach as it relies on While the change is elegant, I personally prefer that we be more explicit here - as code that appears to use legacy logic like the |
Your concern are legitimate and I share them. However we didn't see any major changes in the Magento core and we don't expect any soon. Actually many parts of the Magento code is based on this similar mechanic. I don't see Adobe doing this refactor as it's really big. That's why I ended up doing this, would work for both cases (MSI or not) even if it use a ghost plugin (intended by MSI package to add coverage support on vanilla features) |
Fair points! Meanwhile, accurate stock quantities by warehouse were also a concern which the referenced PR aims to address. Please note although we don't have a timeline we do intend to revisit this in the main module and your feedback will be incorporated. Marking this on hold for now. Thanks again for your help! We really appreciate it! |
Summary
These changes fix the MSI compatibility. It also make this module unnecessary: https://github.com/algolia/algoliasearch-inventory-magento-2
algolia/algoliasearch-inventory-magento-2 is not really maintained anymore and many flaws exists as it does not really follow the changes introduced in the main module.
I've also noticed dead code.
The
$product->getIsSalable()
method use the alias added by MSI while it also fallback to simple inventory management when MSI is disabled.I've also updated how the stock_qty is retrieved so it used the method that MSI have plugged, so if MSI is used, it's automatically compatible.
EDIT:
Change in ProductHelper is BIC