Skip to content
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

Add Magento 2.3 - MSI support for stock checks #2310

Closed
pkarw opened this issue Jan 31, 2019 · 11 comments
Closed

Add Magento 2.3 - MSI support for stock checks #2310

pkarw opened this issue Jan 31, 2019 · 11 comments
Labels
feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can help wanted If you need help or advice P1: Urgent Priority mark - high priority vs-hackathon Tasks for the Hackathon
Milestone

Comments

@pkarw
Copy link
Collaborator

pkarw commented Jan 31, 2019

What is the motivation for adding / enhancing this feature?

With Magento 2.3 there is MSI module included for managing the stocks.
We should add support for it to mage2vuestorefront

https://devdocs.magento.com/redoc/2.3/admin-rest-api.html#operation/inventorySourceSelectionApiSourceSelectionServiceV1ExecutePost

What are the acceptance criteria

  • mage2vuestorefront correctly sets the product available for both: Magento 2.2.x and 2.3.x

Can you complete this feature request by yourself?

Additional information

@pkarw pkarw added the feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can label Jan 31, 2019
@pkarw
Copy link
Collaborator Author

pkarw commented Jan 31, 2019

Related to: #2295

@pkarw pkarw added the vs-hackathon Tasks for the Hackathon label Jan 31, 2019
@pkarw
Copy link
Collaborator Author

pkarw commented Feb 1, 2019

To solve this task we should modify:

  • mage2vuestorefront stock sync
  • vue-storefront-api dynamic stock sync - one endpoint is for getting the single stock item, second is for getting the list of stock items.

The thing is, that all the business logic above operates on Magento-like Stock object which is synced with product.stock. The minimum set of fields of product.stock are:

  • is_in_stock - true/false
  • qty - salable quantity.

The stock object is few different locations of Vue Storefront source. So it's important to keep MSI compatible with it:

What we need is to modify the mage2vuestorefront + vue-storefront-api that in case MSI is enabled (and only in that case - it could be set in vue-storefront-api/config/default.json / mage2vuestorefront/src/config.js or verified other way with Magento2 API) we should probably aggregate the product.stock information (qty and is_in_stock) of source items

I mean - the product.stock should reflect or maybe render the MSI logic but for Vue Storefront it should be transparent if there is an MSI enabled or not.

Note: if the product is configurable - then the same stock object but for the simple products should be rendered to configurable_children.*.stock

Moreover, we could extend mage2vuestorefront to put the source items into product.stock_source_items to just let the VS developers display the available source items for each product. But for core visibility checks it should be just the product.stock

@aleron75
Copy link
Collaborator

aleron75 commented Feb 1, 2019

I'll try to work on this

@aleron75
Copy link
Collaborator

aleron75 commented Feb 5, 2019

Hello,
we have written our analysis in this document: http://bit.ly/vuesf-msi

We'll start working on a proof of concept soon.

If anyone has suggestions/concerns, feel free to comment on the document or here.

@pkarw
Copy link
Collaborator Author

pkarw commented Feb 5, 2019

Thanks! Great job with the analysis document, looks great. Looking forward for the PoC.

Please note that we’re also checking the stock options per configurable child and filter out unavailable variants. It’s done runtime (thru vsapi and then direct call to magento to get the current t stock); not in the mage2vs / it’s the only way to make sure that the product is in stock / not relying on the Elastic / cached stock information which probably isn’t accurate and synced

For the main configurable product we should just “emulate” the stock / setting the product to “is_in_stock” if at least one child is available.

@aleron75
Copy link
Collaborator

Hello @pkarw if I get it well, data pumping will be soon replaced by the native Vue Storefront Magento2 Indexer.

According to this change, is it ok for us to work on integrating MSI on it rather than on the (deprecated?) Data Pump?

Let us know, meanwhile we're working on vue-storefront-api.

@pkarw
Copy link
Collaborator Author

pkarw commented Feb 12, 2019

Dear Allesandro, our official production recommendation currently is mage2vuestorefront - so I believe we should add MSI support to it first. I'm adding URL routing currently - and also the first place is m2vs :)

We need few more weeks (maybe months) to make magento2-vsbridge-indexer stable. So I would like to ask You to go on with m2vs and then we'll copy this behavior to native bridge.

If You think it would be easier for You to work on bridge natively there is then an option to add the support to mafgento2-vsbrdige-indexer exclusively which will make a great argument for users to just use it.

Let me know which way You'd like to proceed?

If You add the logic to native indexer first then probably we'll just copy it to m2vs anyway :)

@aleron75
Copy link
Collaborator

hello @pkarw no problem, we'll go on working on m2vs as well, thanks for sharing the roadmap

@pkarw pkarw modified the milestones: 1.9, 1.10 Feb 25, 2019
@pkarw pkarw added help wanted If you need help or advice P1: Urgent Priority mark - high priority labels Feb 25, 2019
@pkarw pkarw modified the milestones: 1.9, 1.10-rc Mar 2, 2019
@pkarw pkarw modified the milestones: 1.10.0-rc.1, 1.11.0-rc.1 Apr 4, 2019
@pkarw
Copy link
Collaborator Author

pkarw commented Apr 16, 2019

@pkarw pkarw modified the milestones: 1.11.0-rc.1, 1.10.0-rc.1 Apr 28, 2019
@pkarw
Copy link
Collaborator Author

pkarw commented Apr 28, 2019

Done with: vuestorefront/vue-storefront-api#226
Thanks @dimasch and @aleron75

Waiting for final changes to mage2vuestorefront + magento2-vsbridge-indexer

@pkarw
Copy link
Collaborator Author

pkarw commented May 1, 2019

mage2vuestorefront update for MSI: vuestorefront/mage2vuestorefront#86

@pkarw pkarw closed this as completed May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can help wanted If you need help or advice P1: Urgent Priority mark - high priority vs-hackathon Tasks for the Hackathon
Projects
None yet
Development

No branches or pull requests

2 participants