Skip to content

Describe how to query list of attributes relevant to the category #995

@krzysztofwolski

Description

@krzysztofwolski

attributes query allows the user to apply inCategory and inCollection filters. This pattern can be used to create dynamic filters for product listings (show attribute filters relevant to the given category).

query AttributesForCategory{
  attributes(filter: {inCategory:"Q2F0ZWdvcnk6MjU="}, first:10, channel: "default-channel"){
    edges{
      node{
        name
        inputType
        choices(first:10){
          edges{
            node{
              name
            }
          }
        }
      }
    }
  }
}
{
  "data": {
    "attributes": {
      "edges": [
        {
          "node": {
            "name": "Medium",
            "inputType": "DROPDOWN",
            "choices": {
              "edges": [
                {
                  "node": {
                    "name": "Vinyl"
                  }
                },
                {
                  "node": {
                    "name": "DVD"
                  }
                },
                {
                  "node": {
                    "name": "VHS"
                  }
                },
                {
                  "node": {
                    "name": "iTunes"
                  }
                },
                {
                  "node": {
                    "name": "CD"
                  }
                },
                {
                  "node": {
                    "name": "MP3"
                  }
                }
              ]
            }
          }
        },
        ...
### Tasks
- [ ] Add examples for `inCategory` filter in the Attribute guide
- [ ] Add link to this guide in the products section

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions