Added DI StockItemRepository + validation method: validateStockItem #26722
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Description (*)
Added validation is Bundled Item in Stock. And if not -> unset this one from returning an array.
Steps to reproduce (*)
{ products( filter: { category_id: { eq: "2" } } ) { items { sku stock_status ... on BundleProduct { ship_bundle_items weight dynamic_weight dynamic_sku dynamic_price items { option_id type title sku required options { can_change_quantity quantity product { sku stock_status } price_type price position label is_default id } } } ... on CustomizableProductInterface { options { option_id required sort_order title __typename } } } } }Expected result (*)
Actual result (*)
{ "data": { "products": { "items": [ { "sku": "b1-separately (bundle)", "stock_status": "IN_STOCK", "ship_bundle_items": "SEPARATELY", "weight": null, "dynamic_weight": false, "dynamic_sku": false, "dynamic_price": false, "items": [ { "option_id": 1, "type": "multi", "title": "bund-opt-1-only", "sku": "b1-separately (bundle)", "required": true, "options": [ { "can_change_quantity": false, "quantity": 1, "product": null, "price_type": "FIXED", "price": 0, "position": 1, "label": null, "is_default": true, "id": 1 }, { "can_change_quantity": false, "quantity": 1, "product": { "sku": "bundle-simple-1-in", "stock_status": "IN_STOCK" }, "price_type": "FIXED", "price": 0, "position": 2, "label": "bundle-simple-1-in", "is_default": false, "id": 2 }, { "can_change_quantity": false, "quantity": 2, "product": { "sku": "virtual-prod", "stock_status": "IN_STOCK" }, "price_type": "FIXED", "price": 0, "position": 3, "label": "virtual-prod", "is_default": false, "id": 3 } ] } ], "options": null }, { "sku": "bundle-simple-1-in", "stock_status": "IN_STOCK", "options": null }, { "sku": "virtual-prod", "stock_status": "IN_STOCK", "options": null } ] } } }