Skip to content

Magento 2 custom attribute filter not working graphql products query in product attribute custom source #31361

Closed
@prabhakaran777

Description

@prabhakaran777

Preconditions (*)

1.Magento 2.3.5-p2 had issue on product custom attribute Filter with custom source (Setup/Patch/CustomSelectOption)

2.But it's Working in Product Collection

Steps to reproduce (*)

1.Magento 2.3.5-p2

2.Create custom product attribute via setup patch (with select option) - also custom source model file

class ProductCustomType extends AbstractSource
{
    public function getAllOptions()
    {
        if ($this->_options === null) {
            $this->_options = [

                ['value' => '', 'label' => __('-- Select an Option --')],
                ['value' => 'new', 'label' => __('New')],
                ['value' => 'old', 'label' => __('Old')],
               
            ];
        }
        return $this->_options;
    }
}

3.Assign product type to any of the product

4.Graphql

Req:

{
  products(filter:{
    product_custom_type:{
      eq:"new"
     }
  
  }){
    total_count
    items{
      id
     sku
    product_custom_type
    }
  }
}

Response:

{
  "data": {
    "products": {
      "total_count": 0,
      "items": []
    }
  }
}

Expected result (*)

  1. Get Products in Products query Response.

Actual result (*)

Screenshot from 2020-12-19 12-13-33

Response:

{
  "data": {
    "products": {
      "total_count": 0,
      "items": []
    }
  }
}


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Issue: Cannot ReproduceCannot reproduce the issue on the latest `2.4-develop` branchIssue: needs updateAdditional information is require, waiting for responseIssue: ready for confirmationPAPPartners acceleration programPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: doneProject: GraphQLTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions