Skip to content

Added DI StockItemRepository + validation method: validateStockItem #26722

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

Open
wants to merge 1 commit into
base: 2.4-develop
Choose a base branch
from

Conversation

sedonik
Copy link
Contributor

@sedonik sedonik commented Feb 5, 2020

Description (*)

Added validation is Bundled Item in Stock. And if not -> unset this one from returning an array.

  1. If bundle item is OUT_OF_STOCK then it should not show at all #26109: If bundle item is OUT_OF_STOCK then it should not show at all

Steps to reproduce (*)

  1. Filter products
{
  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 (*)

  1. 2 items in multiselect
    image (1)

Actual result (*)

  1. 2 items + 1 empty item for any Product that is out of stock
{
  "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
        }
      ]
    }
  }
}

@m2-assistant
Copy link

m2-assistant bot commented Feb 5, 2020

Hi @sedonik. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

@damienwebdev
Copy link
Member

I believe this likely has a dependence on the admin field cataloginventory/options/show_out_of_stock, I don't know (off the top of my head) whether or not this PR takes that into account.

@m2-community-project m2-community-project bot added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Dec 15, 2020
@ihor-sviziev ihor-sviziev removed this from the 2.4.2 milestone Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Insider: Magecom community-insider-contribution Component: BundleGraphQl Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: review Project: GraphQL Release Line: 2.4 Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
Status: Review in Progress
Development

Successfully merging this pull request may close these issues.

7 participants