How To Get Layered Navigation Data / Search Filter Data Using GraphQL in Magento 2.x

The following below Magento 2.x GraphQL Query to get Layered Navigation Data / Search Filter Data

Syntax

{
  products(filter: { Filter Query}) {

  Filter Data
  }
}  

Below GraphQL query to get all Search Filter Data , where Category ID is 10

{
  products(filter: { category_id: { eq: "10" } }) {
    total_count
    aggregations{
      attribute_code
      label
      count
      options{
        count
        label
        value
      }
    }
  }
}

Response ::

{
  "data": {
    "products": {
      "total_count": 11,
      "aggregations": [
        {
          "attribute_code": "price",
          "label": "Price",
          "count": 5,
          "options": [
            {
              "count": 4,
              "label": "40-50",
              "value": "40_50"
            },
            {
              "count": 2,
              "label": "50-60",
              "value": "50_60"
            },
            {
              "count": 3,
              "label": "60-70",
              "value": "60_70"
            },
            {
              "count": 1,
              "label": "70-80",
              "value": "70_80"
            },
            {
              "count": 1,
              "label": "90-*",
              "value": "90_*"
            }
          ]
        },
        {
          "attribute_code": "category_id",
          "label": "Category",
          "count": 3,
          "options": [
            {
              "count": 11,
              "label": "Tops",
              "value": "12"
            },
            {
              "count": 11,
              "label": "Jackets",
              "value": "14"
            },
            {
              "count": 2,
              "label": "Eco Friendly",
              "value": "36"
            }
          ]
        },
        {
          "attribute_code": "climate",
          "label": "Climate",
          "count": 10,
          "options": [
            {
              "count": 10,
              "label": "Spring",
              "value": "207"
            },
            {
              "count": 9,
              "label": "Cool",
              "value": "203"
            },
            {
              "count": 9,
              "label": "Windy",
              "value": "209"
            },
            {
              "count": 5,
              "label": "All-Weather",
              "value": "201"
            },
            {
              "count": 5,
              "label": "Rainy",
              "value": "206"
            },
            {
              "count": 4,
              "label": "Mild",
              "value": "205"
            },
            {
              "count": 3,
              "label": "Wintry",
              "value": "210"
            },
            {
              "count": 2,
              "label": "Cold",
              "value": "202"
            },
            {
              "count": 2,
              "label": "Indoor",
              "value": "204"
            },
            {
              "count": 1,
              "label": "Warm",
              "value": "208"
            }
          ]
        },
        {
          "attribute_code": "color",
          "label": "Color",
          "count": 9,
          "options": [
            {
              "count": 6,
              "label": "Black",
              "value": "49"
            },
            {
              "count": 6,
              "label": "Red",
              "value": "58"
            },
            {
              "count": 5,
              "label": "Blue",
              "value": "50"
            },
            {
              "count": 5,
              "label": "Green",
              "value": "53"
            },
            {
              "count": 4,
              "label": "Orange",
              "value": "56"
            },
            {
              "count": 3,
              "label": "Yellow",
              "value": "60"
            },
            {
              "count": 2,
              "label": "Purple",
              "value": "57"
            },
            {
              "count": 1,
              "label": "Gray",
              "value": "52"
            },
            {
              "count": 1,
              "label": "White",
              "value": "59"
            }
          ]
        },
        {
          "attribute_code": "eco_collection",
          "label": "Eco Collection",
          "count": 1,
          "options": [
            {
              "count": 2,
              "label": "1",
              "value": "1"
            }
          ]
        },
        {
          "attribute_code": "erin_recommends",
          "label": "Erin Recommends",
          "count": 1,
          "options": [
            {
              "count": 2,
              "label": "1",
              "value": "1"
            }
          ]
        },
        {
          "attribute_code": "material",
          "label": "Material",
          "count": 10,
          "options": [
            {
              "count": 9,
              "label": "Polyester",
              "value": "38"
            },
            {
              "count": 5,
              "label": "Fleece",
              "value": "144"
            },
            {
              "count": 5,
              "label": "Nylon",
              "value": "37"
            },
            {
              "count": 2,
              "label": "Cocona® performance fabric",
              "value": "142"
            },
            {
              "count": 2,
              "label": "LumaTech™",
              "value": "147"
            },
            {
              "count": 1,
              "label": "Hemp",
              "value": "145"
            },
            {
              "count": 1,
              "label": "Lycra®",
              "value": "148"
            },
            {
              "count": 1,
              "label": "Spandex",
              "value": "150"
            },
            {
              "count": 1,
              "label": "Wool",
              "value": "158"
            },
            {
              "count": 1,
              "label": "Cotton",
              "value": "33"
            }
          ]
        },
        {
          "attribute_code": "new",
          "label": "New",
          "count": 1,
          "options": [
            {
              "count": 2,
              "label": "1",
              "value": "1"
            }
          ]
        },
        {
          "attribute_code": "pattern",
          "label": "Pattern",
          "count": 1,
          "options": [
            {
              "count": 11,
              "label": "Solid",
              "value": "196"
            }
          ]
        },
        {
          "attribute_code": "performance_fabric",
          "label": "Performance Fabric",
          "count": 1,
          "options": [
            {
              "count": 3,
              "label": "1",
              "value": "1"
            }
          ]
        },
        {
          "attribute_code": "sale",
          "label": "Sale",
          "count": 1,
          "options": [
            {
              "count": 2,
              "label": "1",
              "value": "1"
            }
          ]
        },
        {
          "attribute_code": "size",
          "label": "Size",
          "count": 5,
          "options": [
            {
              "count": 11,
              "label": "XS",
              "value": "166"
            },
            {
              "count": 11,
              "label": "S",
              "value": "167"
            },
            {
              "count": 11,
              "label": "M",
              "value": "168"
            },
            {
              "count": 11,
              "label": "L",
              "value": "169"
            },
            {
              "count": 11,
              "label": "XL",
              "value": "170"
            }
          ]
        },
        {
          "attribute_code": "style_general",
          "label": "Style General",
          "count": 12,
          "options": [
            {
              "count": 7,
              "label": "¼ zip",
              "value": "127"
            },
            {
              "count": 6,
              "label": "Lightweight",
              "value": "119"
            },
            {
              "count": 6,
              "label": "Windbreaker",
              "value": "125"
            },
            {
              "count": 5,
              "label": "Insulated",
              "value": "116"
            },
            {
              "count": 5,
              "label": "Rain Coat",
              "value": "122"
            },
            {
              "count": 5,
              "label": "Hard Shell",
              "value": "123"
            },
            {
              "count": 5,
              "label": "Soft Shell",
              "value": "124"
            },
            {
              "count": 5,
              "label": "Full Zip",
              "value": "128"
            },
            {
              "count": 3,
              "label": "Hooded",
              "value": "120"
            },
            {
              "count": 2,
              "label": "Heavy Duty",
              "value": "121"
            },
            {
              "count": 1,
              "label": "Jacket",
              "value": "117"
            },
            {
              "count": 1,
              "label": "Reversible",
              "value": "129"
            }
          ]
        }
      ]
    }

Below GraphQL query to get all Search Filter Data , where Category ID is 10 and Price range from 10 To 500 USD

{
      products(filter: { category_id: { in: "10" }, price: {from: "10" to: "500"} }) {


    total_count
    aggregations{
      attribute_code
      label
      count
      options{
        count
        label
        value
      }
    }
  }
}

Response::

{
  "data": {
    "products": {
      "total_count": 4,
      "aggregations": [
        {
          "attribute_code": "price",
          "label": "Price",
          "count": 2,
          "options": [
            {
              "count": 3,
              "label": "10-20",
              "value": "10_20"
            },
            {
              "count": 1,
              "label": "20-*",
              "value": "20_*"
            }
          ]
        },
        {
          "attribute_code": "category_id",
          "label": "Category",
          "count": 2,
          "options": [
            {
              "count": 4,
              "label": "Training",
              "value": "9"
            },
            {
              "count": 4,
              "label": "Video Download",
              "value": "10"
            }
          ]
        },
        {
          "attribute_code": "activity",
          "label": "Activity",
          "count": 5,
          "options": [
            {
              "count": 4,
              "label": "Athletic",
              "value": "16"
            },
            {
              "count": 3,
              "label": "Gym",
              "value": "11"
            },
            {
              "count": 2,
              "label": "Sports",
              "value": "17"
            },
            {
              "count": 2,
              "label": "Yoga",
              "value": "8"
            },
            {
              "count": 1,
              "label": "Outdoor",
              "value": "5"
            }
          ]
        },
        {
          "attribute_code": "format",
          "label": "Format",
          "count": 1,
          "options": [
            {
              "count": 4,
              "label": "Download",
              "value": "102"
            }
          ]
        }
      ]
    }
  }
}

How To Get Product List Data Using GraphQL in Magento 2.x

The following below Magento 2.x GraphQL Query to get Product List Data.

categoryList (
   filters: CategoryFilterInput
): Products Data
{
  categoryList(filters: {ids: {eq: "10"}}) {
    products {
      total_count
      items{
        id
        sku
        name
        url_key
        stock_status
        new
        image{
          url
          label
          position
        }
        small_image{
          url
          label
          position
        }
        thumbnail{
          url
          label
          position
        }
        short_description{
          html
        }
        description{
          html
        }
        price_range{
          minimum_price{
            regular_price{
              value
              currency
            }
            final_price{
              value
              currency
            }
          }
          maximum_price{
            regular_price{
              value
              currency
            }
            final_price{
              value
              currency
            }
          }
        }
        new_from_date
        new_to_date
        special_price
        special_from_date
        special_to_date
        gift_message_available
        country_of_manufacture
        price_tiers{
          quantity
          final_price{
            value
            currency
          }
          discount{
            amount_off
            percent_off
          }
        }
      }
      page_info {
        current_page
        page_size
      }
    }
  }
}

Response::

{
  "data": {
    "categoryList": [
      {
        "products": {
          "total_count": 6,
          "items": [
            {
              "id": 52,
              "sku": "240-LV09",
              "name": "Luma Yoga For Life",
              "url_key": "luma-yoga-for-life",
              "stock_status": "IN_STOCK",
              "new": null,
              "image": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt06.jpg",
                "label": "Luma Yoga For Life",
                "position": null
              },
              "small_image": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt06.jpg",
                "label": "Luma Yoga For Life",
                "position": null
              },
              "thumbnail": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt06.jpg",
                "label": "Luma Yoga For Life",
                "position": null
              },
              "short_description": {
                "html": "<p>\nLuma founder Erin Renny on yoga and longevity: \"I won't promise you'll live longer with yoga. No one can promise that. But your life will be healthier, less stressful, and more physically in tune when you focus on connecting your mind and body or a regular basis. Yoga is my favorite way to express this connection. I want to share the secrets of lifelong yoga with anyone willing to breathe and learn with me.\"\n</p>"
              },
              "description": {
                "html": "<ul><li>Increase strength + flexibility + metabolism</li><li>Burn calories + feel great</li><li>Gain energy + youthfulness + mental wellness</li> </ul><h3 style=\"margin-top: 30px;\">Download description</h3><p><strong style=\"display: block; margin: 20px 0 5px;\">Tone up mind and body</strong>Pro Yoga Instructor and Master Practitioner Marie Peale helps tone and sculpt your physique with her invigorating yet gentle approach.</p><p>You'll learn to use yoga to relax, control stress and increase your calorie-burning capacity, all while exploring traditional and new yoga poses that lengthen and strengthen your full muscular structure.  </p><ul><li>Easy download</li><li>Audio options: Music and instruction or instruction only</li><li>Heart rate techniques explained</li><li>Breathing techniques explained</li><li>Move through exercises at your own pace</li></ul><p>Two 25-minute workout episodes and one 40-minute workout episode with warm-up and cool down:</p><p><strong style=\"display: block; margin: 20px 0 5px;\">Episode 1</strong>Creative, fun session geared toward opening your lungs. Combines stretching and breathing with a focus on hips and shoulders. </p><p><strong style=\"display: block; margin: 20px 0 5px;\">Episode 2</strong>Ramp up the tempo and energy with calorie-burning flows. A stimulating workout introducing the body-sculpting power of yoga.</p><p><strong style=\"display: block; margin: 20px 0 5px;\">Episode 3</strong>Push your fitness reach and stamina with an intense series of standing and floor exercises and poses. End this extra-length session with a meditative cool down.</p><h3 style=\"margin-top: 30px;\">instructor bio</h3><p><strong style=\"display: block; margin: 20px 0 5px;\">About Marie</strong>Marie is a trained martial artist and dancer with a BS in Biological Engineering and over 10 years as a certified yoga teacher. Marie has studied yoga in England, India and, in 2009, at the Ashraqat Ashram Yoga Farm in the United States. She has been teaching full time since then. Her focus on strength and wellness combines a deep knowledge of human biology and motivation guided by unconditional love for her audience.</p>"
              },
              "price_range": {
                "minimum_price": {
                  "regular_price": {
                    "value": 0,
                    "currency": "INR"
                  },
                  "final_price": {
                    "value": 0,
                    "currency": "INR"
                  }
                },
                "maximum_price": {
                  "regular_price": {
                    "value": 0,
                    "currency": "INR"
                  },
                  "final_price": {
                    "value": 0,
                    "currency": "INR"
                  }
                }
              },
              "new_from_date": null,
              "new_to_date": null,
              "special_price": null,
              "special_from_date": null,
              "special_to_date": null,
              "gift_message_available": null,
              "country_of_manufacture": null,
              "price_tiers": []
            },
            {
              "id": 51,
              "sku": "240-LV08",
              "name": "Advanced Pilates & Yoga (Strength)",
              "url_key": "advanced-pilates-yoga-strength",
              "stock_status": "IN_STOCK",
              "new": null,
              "image": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt05.jpg",
                "label": "Advanced Pilates & Yoga (Strength)",
                "position": null
              },
              "small_image": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt05.jpg",
                "label": "Advanced Pilates & Yoga (Strength)",
                "position": null
              },
              "thumbnail": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt05.jpg",
                "label": "Advanced Pilates & Yoga (Strength)",
                "position": null
              },
              "short_description": {
                "html": "<p>\nNo equipment needed. Advanced Pilates & Yoga (Strength) is a muscle-defining program that employs balance, cardio and flexibility movements with plyometric and body-weight based exercises for an all-around, physically challenging workout. The Pilates elements of this compilation bring gentle resistance principals into the routines, emphasizing safety, technique and range of motion.\n</p>"
              },
              "description": {
                "html": "<p>Advanced Pilates & Yoga will help you to increase your flexibility and tone core muscle groups through an invigorating workout for your whole body. The Pilates workout is a thorough strength-conditioning session that boosts flexibility, endurance and posture. The Yoga workout incorporates legacy and new poses into one continuous routine that will leave you feeling exhausted and fulfilled at once.</p>\n<ul>\n<li>Pilates-Yoga fusion.</li>\n<li>Breathing warmup and cooldown.</li>\n<li>Hour-long session.</li>\n<li>High-definition video.</li>\n<ul>"
              },
              "price_range": {
                "minimum_price": {
                  "regular_price": {
                    "value": 18,
                    "currency": "INR"
                  },
                  "final_price": {
                    "value": 18,
                    "currency": "INR"
                  }
                },
                "maximum_price": {
                  "regular_price": {
                    "value": 18,
                    "currency": "INR"
                  },
                  "final_price": {
                    "value": 18,
                    "currency": "INR"
                  }
                }
              },
              "new_from_date": null,
              "new_to_date": null,
              "special_price": null,
              "special_from_date": null,
              "special_to_date": null,
              "gift_message_available": null,
              "country_of_manufacture": null,
              "price_tiers": []
            },
            {
              "id": 50,
              "sku": "240-LV07",
              "name": "Solo Power Circuit",
              "url_key": "solo-power-circuit",
              "stock_status": "IN_STOCK",
              "new": null,
              "image": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt04.jpg",
                "label": "Solo Power Circuit",
                "position": null
              },
              "small_image": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt04.jpg",
                "label": "Solo Power Circuit",
                "position": null
              },
              "thumbnail": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt04.jpg",
                "label": "Solo Power Circuit",
                "position": null
              },
              "short_description": {
                "html": "<p>\nMany contemporary exercise trends sacrifice form and precision in favor of reps and \"PR\" goals. Luma's Solo Power Circuit teaches techniques to keep you safe. But don't think you'll get off easily: when it comes to building muscle and burning fat, these routines won't disappoint. A fusion of circuit training, yoga, Pilates and running, Solo Power Circuit brings out your sweatiest best.\n</p>"
              },
              "description": {
                "html": "<p>Circuit training helps banish the boredom of traditional workouts. The Solo Power Circuit download lets you experience Luma's maximum efficiency circuit training in the training time you have available. Learn secrets to shed pounds, decrease body fat, sculpt amazing abs, and tone to reshape your entire body. You'll feel the difference after just one circuit.</p>\n<ul>\n<li>Targets abs, arms and legs.</li>\n<li>6 fun interval training circuits.</li>\n<li>Easy to follow.</li>\n<li>No special equipment needed.</li>\n<li>43 minutes.</li>\n</ul>"
              },
              "price_range": {
                "minimum_price": {
                  "regular_price": {
                    "value": 14,
                    "currency": "INR"
                  },
                  "final_price": {
                    "value": 14,
                    "currency": "INR"
                  }
                },
                "maximum_price": {
                  "regular_price": {
                    "value": 14,
                    "currency": "INR"
                  },
                  "final_price": {
                    "value": 14,
                    "currency": "INR"
                  }
                }
              },
              "new_from_date": null,
              "new_to_date": null,
              "special_price": null,
              "special_from_date": null,
              "special_to_date": null,
              "gift_message_available": null,
              "country_of_manufacture": null,
              "price_tiers": []
            },
            {
              "id": 49,
              "sku": "240-LV06",
              "name": "Yoga Adventure",
              "url_key": "yoga-adventure",
              "stock_status": "IN_STOCK",
              "new": null,
              "image": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt03.jpg",
                "label": "Yoga Adventure",
                "position": null
              },
              "small_image": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt03.jpg",
                "label": "Yoga Adventure",
                "position": null
              },
              "thumbnail": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt03.jpg",
                "label": "Yoga Adventure",
                "position": null
              },
              "short_description": {
                "html": "<p>\nThe practices on this downloadable training video are recommended only for experienced to advanced students. Those with the fundamental skills needed won't want to miss the insight and advice from world-renowned trainer Erin Renny in these exclusive Luma guided yoga sessions. Complete body, arm balance and leg strength workouts engage, strengthen and increase mobility.\n</p>"
              },
              "description": {
                "html": "<p>Luma presents an innovative power vinyasa yoga class for intermediate and advanced practitioners. The video allows you to pace yourself, but more intense work yields longer rest. This class is great for more advanced students looking to learn proper alignment in their yoga practice.</p>\n<ul>\n<li>Includes a breakdown of 12 different postures.</li>\n<li>Chataranga Dandasana and prayer twist.</li>\n<li>Challenging posture (side crow).</li>\n<li>55 minutes of movement.</li>\n</ul>"
              },
              "price_range": {
                "minimum_price": {
                  "regular_price": {
                    "value": 22,
                    "currency": "INR"
                  },
                  "final_price": {
                    "value": 22,
                    "currency": "INR"
                  }
                },
                "maximum_price": {
                  "regular_price": {
                    "value": 22,
                    "currency": "INR"
                  },
                  "final_price": {
                    "value": 22,
                    "currency": "INR"
                  }
                }
              },
              "new_from_date": null,
              "new_to_date": null,
              "special_price": null,
              "special_from_date": null,
              "special_to_date": null,
              "gift_message_available": null,
              "country_of_manufacture": null,
              "price_tiers": []
            },
            {
              "id": 48,
              "sku": "240-LV05",
              "name": "LifeLong Fitness IV",
              "url_key": "lifelong-fitness-iv",
              "stock_status": "IN_STOCK",
              "new": null,
              "image": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt02.jpg",
                "label": "LifeLong Fitness IV",
                "position": null
              },
              "small_image": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt02.jpg",
                "label": "LifeLong Fitness IV",
                "position": null
              },
              "thumbnail": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt02.jpg",
                "label": "LifeLong Fitness IV",
                "position": null
              },
              "short_description": {
                "html": "<p>\nThe instructors and routines featured in LifeLong Fitness IV provide safe options to serve all types of physical conditions and abilities. Range of motion, body awareness and breathing practices are essential tools of yogic self-care, essential for maintaining alertness, health, and dignity over a lifetime. The LifeLong Fitness series acknowledges that as we age, the safety and sustainability of our exercise become as important as pushing our limits.\n</p>"
              },
              "description": {
                "html": "<p>Luma LifeLong Fitness Series is a world recognized, evidence based exercise program designed specifically for individuals focused on staying active their whole lives. If followed regularly, participants will see improved heart rate and blood pressure, increased mobility, reduced joint pain and overall improvement in functional fitness and health.</>\n<ul>\n<li>10 minute warm up.</li>\n<li>30 minutes of mild aerobics.</li>\n<li>20 minutes of strength, stretch and balance.</li>\n<li>Extensive modifications for varying fitness levels.</li>\n</ul>"
              },
              "price_range": {
                "minimum_price": {
                  "regular_price": {
                    "value": 14,
                    "currency": "INR"
                  },
                  "final_price": {
                    "value": 14,
                    "currency": "INR"
                  }
                },
                "maximum_price": {
                  "regular_price": {
                    "value": 14,
                    "currency": "INR"
                  },
                  "final_price": {
                    "value": 14,
                    "currency": "INR"
                  }
                }
              },
              "new_from_date": null,
              "new_to_date": null,
              "special_price": null,
              "special_from_date": null,
              "special_to_date": null,
              "gift_message_available": null,
              "country_of_manufacture": null,
              "price_tiers": []
            },
            {
              "id": 47,
              "sku": "240-LV04",
              "name": "Beginner's Yoga",
              "url_key": "beginner-s-yoga",
              "stock_status": "IN_STOCK",
              "new": null,
              "image": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt01.jpg",
                "label": "Beginner's Yoga",
                "position": null
              },
              "small_image": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt01.jpg",
                "label": "Beginner's Yoga",
                "position": null
              },
              "thumbnail": {
                "url": "http://dev.mage24.com/media/catalog/product\\cache\\7ec6eea3abf148ef420ab5f692bfda24\\/l/t/lt01.jpg",
                "label": "Beginner's Yoga",
                "position": null
              },
              "short_description": {
                "html": "<p>\nThe most difficult yoga poses to master are the ones learned incorrectly as a beginner. Luma's Beginner's Yoga is a fantastic way to break into your initial yoga session and begin the journey to a longer, leaner, healthier body. Confidently find your way into yoga with this effective yet gentle program. You'll learn proper alignment and how to sidestep common mistakes.\n</p>"
              },
              "description": {
                "html": "<p>Beginner's Yoga starts you down the path toward strength, balance and mental focus. With this video download, you don't have to be a great athlete or gym guru to learn the best and most basic techniques for lifelong yoga foundation. </p>\n<ul>\n<li>Video download</li>\n<li>Five workouts.</li>\n<li>Balance, strength and endurance.</li>\n<li>Flexibility and core strength.</li>\n<li>Includes modification for novices.</li>\n</ul>"
              },
              "price_range": {
                "minimum_price": {
                  "regular_price": {
                    "value": 6,
                    "currency": "INR"
                  },
                  "final_price": {
                    "value": 6,
                    "currency": "INR"
                  }
                },
                "maximum_price": {
                  "regular_price": {
                    "value": 6,
                    "currency": "INR"
                  },
                  "final_price": {
                    "value": 6,
                    "currency": "INR"
                  }
                }
              },
              "new_from_date": null,
              "new_to_date": null,
              "special_price": null,
              "special_from_date": null,
              "special_to_date": null,
              "gift_message_available": null,
              "country_of_manufacture": null,
              "price_tiers": []
            }
          ],
          "page_info": {
            "current_page": 1,
            "page_size": 20
          }
        }
      }
    ]
  }
}

How To Get Category List Data Using GraphQL in Magento 2.x

The following below Magento 2.x GraphQL Query to get Category List Data

categoryList (
   filters: CategoryFilterInput
): CategoryTree

This Query supports following below Query

  1. By Using Category ID
  2. By Using Category Name
  3. By Using URL Key
  4. By Using URL Path
  1. By Using Category ID
{
  categoryList(filters: {ids: {in: ["3", "20"]}}) {
    children_count
    children {
      id
      level
      name
      path
      url_path
      url_key
      image
      description
      children {
        id
        level
        name
        path
        url_path
        url_key
        image
        description
      }
    }
  }
}

Response::

{
  "data": {
    "categoryList": [
      {
        "children_count": "3",
        "children": [
          {
            "id": 4,
            "level": 3,
            "name": "Bags",
            "path": "1/2/3/4",
            "url_path": "gear/bags",
            "url_key": "bags",
            "image": null,
            "description": null,
            "children": []
          },
          {
            "id": 5,
            "level": 3,
            "name": "Fitness Equipment",
            "path": "1/2/3/5",
            "url_path": "gear/fitness-equipment",
            "url_key": "fitness-equipment",
            "image": null,
            "description": null,
            "children": []
          },
          {
            "id": 6,
            "level": 3,
            "name": "Watches",
            "path": "1/2/3/6",
            "url_path": "gear/watches",
            "url_key": "watches",
            "image": null,
            "description": null,
            "children": []
          }
        ]
      },
      {
        "children_count": "8",
        "children": [
          {
            "id": 22,
            "level": 3,
            "name": "Bottoms",
            "path": "1/2/20/22",
            "url_path": "women/bottoms-women",
            "url_key": "bottoms-women",
            "image": null,
            "description": null,
            "children": [
              {
                "id": 27,
                "level": 4,
                "name": "Pants",
                "path": "1/2/20/22/27",
                "url_path": "women/bottoms-women/pants-women",
                "url_key": "pants-women",
                "image": null,
                "description": null
              },
              {
                "id": 28,
                "level": 4,
                "name": "Shorts",
                "path": "1/2/20/22/28",
                "url_path": "women/bottoms-women/shorts-women",
                "url_key": "shorts-women",
                "image": null,
                "description": null
              }
            ]
          },
          {
            "id": 21,
            "level": 3,
            "name": "Tops",
            "path": "1/2/20/21",
            "url_path": "women/tops-women",
            "url_key": "tops-women",
            "image": null,
            "description": null,
            "children": [
              {
                "id": 23,
                "level": 4,
                "name": "Jackets",
                "path": "1/2/20/21/23",
                "url_path": "women/tops-women/jackets-women",
                "url_key": "jackets-women",
                "image": null,
                "description": null
              },
              {
                "id": 24,
                "level": 4,
                "name": "Hoodies & Sweatshirts",
                "path": "1/2/20/21/24",
                "url_path": "women/tops-women/hoodies-and-sweatshirts-women",
                "url_key": "hoodies-and-sweatshirts-women",
                "image": null,
                "description": null
              },
              {
                "id": 25,
                "level": 4,
                "name": "Tees",
                "path": "1/2/20/21/25",
                "url_path": "women/tops-women/tees-women",
                "url_key": "tees-women",
                "image": null,
                "description": null
              },
              {
                "id": 26,
                "level": 4,
                "name": "Bras & Tanks",
                "path": "1/2/20/21/26",
                "url_path": "women/tops-women/tanks-women",
                "url_key": "tanks-women",
                "image": null,
                "description": null
              }
            ]
          }
        ]
      }
    ]

[2] – By Using Category Name

{
	categoryList(filters: { name: { match: "Gear" } }) {
	products {
	total_count
		page_info {
		current_page
		page_size
		}
	 }
	children_count
		children {
		id
		level
		name
		path
			children {
			id
			level
			name
			path
				children {
				id
				level
				name
				path
				children {
				id
				level
				name
				path
				}
				}
			}
		}
	}
}

Response ::

{
  "data": {
    "categoryList": [
      {
        "products": {
          "total_count": 34,
          "page_info": {
            "current_page": 1,
            "page_size": 20
          }
        },
        "children_count": "3",
        "children": [
          {
            "id": 4,
            "level": 3,
            "name": "Bags",
            "path": "1/2/3/4",
            "children": []
          },
          {
            "id": 5,
            "level": 3,
            "name": "Fitness Equipment",
            "path": "1/2/3/5",
            "children": []
          },
          {
            "id": 6,
            "level": 3,
            "name": "Watches",
            "path": "1/2/3/6",
            "children": []
          }
        ]
      }
    ]
  }
}

By Using Root Category 2

{
	category(id: 2) {
	products {
	total_count
		page_info {
		current_page
		page_size
		}
	 }
	children_count
		children {
		id
		level
		name
		path
			children {
			id
			level
			name
			path
				children {
				id
				level
				name
				path
				children {
				id
				level
				name
				path
				}
				}
			}
		}
	}
}

Above Query Response :: All List of Categories & Sub Categories Data

{
  "data": {
    "category": {
      "products": {
        "total_count": 187,
        "page_info": {
          "current_page": 1,
          "page_size": 20
        }
      },
      "children_count": "38",
      "children": [
        {
          "id": 20,
          "level": 2,
          "name": "Women",
          "path": "1/2/20",
          "children": [
            {
              "id": 22,
              "level": 3,
              "name": "Bottoms",
              "path": "1/2/20/22",
              "children": [
                {
                  "id": 27,
                  "level": 4,
                  "name": "Pants",
                  "path": "1/2/20/22/27",
                  "children": []
                },
                {
                  "id": 28,
                  "level": 4,
                  "name": "Shorts",
                  "path": "1/2/20/22/28",
                  "children": []
                }
              ]
            },
            {
              "id": 21,
              "level": 3,
              "name": "Tops",
              "path": "1/2/20/21",
              "children": [
                {
                  "id": 23,
                  "level": 4,
                  "name": "Jackets",
                  "path": "1/2/20/21/23",
                  "children": []
                },
                {
                  "id": 24,
                  "level": 4,
                  "name": "Hoodies & Sweatshirts",
                  "path": "1/2/20/21/24",
                  "children": []
                },
                {
                  "id": 25,
                  "level": 4,
                  "name": "Tees",
                  "path": "1/2/20/21/25",
                  "children": []
                },
                {
                  "id": 26,
                  "level": 4,
                  "name": "Bras & Tanks",
                  "path": "1/2/20/21/26",
                  "children": []
                }
              ]
            }
          ]
        },
        {
          "id": 11,
          "level": 2,
          "name": "Men",
          "path": "1/2/11",
          "children": [
            {
              "id": 12,
              "level": 3,
              "name": "Tops",
              "path": "1/2/11/12",
              "children": [
                {
                  "id": 14,
                  "level": 4,
                  "name": "Jackets",
                  "path": "1/2/11/12/14",
                  "children": []
                },
                {
                  "id": 15,
                  "level": 4,
                  "name": "Hoodies & Sweatshirts",
                  "path": "1/2/11/12/15",
                  "children": []
                },
                {
                  "id": 16,
                  "level": 4,
                  "name": "Tees",
                  "path": "1/2/11/12/16",
                  "children": []
                },
                {
                  "id": 17,
                  "level": 4,
                  "name": "Tanks",
                  "path": "1/2/11/12/17",
                  "children": []
                }
              ]
            },
            {
              "id": 13,
              "level": 3,
              "name": "Bottoms",
              "path": "1/2/11/13",
              "children": [
                {
                  "id": 18,
                  "level": 4,
                  "name": "Pants",
                  "path": "1/2/11/13/18",
                  "children": []
                },
                {
                  "id": 19,
                  "level": 4,
                  "name": "Shorts",
                  "path": "1/2/11/13/19",
                  "children": []
                }
              ]
            }
          ]
        },
        {
          "id": 9,
          "level": 2,
          "name": "Training",
          "path": "1/2/9",
          "children": [
            {
              "id": 10,
              "level": 3,
              "name": "Video Download",
              "path": "1/2/9/10",
              "children": []
            }
          ]
        },
        {
          "id": 3,
          "level": 2,
          "name": "Gear",
          "path": "1/2/3",
          "children": [
            {
              "id": 4,
              "level": 3,
              "name": "Bags",
              "path": "1/2/3/4",
              "children": []
            },
            {
              "id": 5,
              "level": 3,
              "name": "Fitness Equipment",
              "path": "1/2/3/5",
              "children": []
            },
            {
              "id": 6,
              "level": 3,
              "name": "Watches",
              "path": "1/2/3/6",
              "children": []
            }
          ]
        },
        {
          "id": 38,
          "level": 2,
          "name": "What's New",
          "path": "1/2/38",
          "children": []
        },
        {
          "id": 37,
          "level": 2,
          "name": "Sale",
          "path": "1/2/37",
          "children": []
        }
      ]
    }
  }
}

How To Get CMS Block Data Using GraphQL in Magento 2.x

The following below Magento 2.x GraphQL Query

Syntax

To Get One CMS Block

cmsBlocks(identifiers: String): CmsBlocks

To Get One Multiple CMS Block

cmsBlocks(identifiers: [String,String]): CmsBlocks

[1] To Get Home Page Block Data

{
  cmsBlocks(identifiers: "home-page-block") {
    items {
      identifier
      title
      content
    }
  }
}

[2] To Get Contact Us Block Data

{
  cmsBlocks(identifiers: "contact-us-info") {
    items {
      identifier
      title
      content
    }
  }
}

[3] To Get Login Block Data

{
  cmsBlocks(identifiers: "login-data") {
    items {
      identifier
      title
      content
    }
  }
}

[4] To Get Gift Card Block Data

{
  cmsBlocks(identifiers: "giftcard-block") {
    items {
      identifier
      title
      content
    }
  }
}

How To Get CMS Page Using GraphQL in Magento 2.x

The following below Magento 2.x GraphQL Query

Syntax

cmsPage(identifier: String): CmsPage

Here identifier, CMS Page’s identifier always unique

[1] To Display 404 Not Found Page

{
  cmsPage(identifier: "no-route") {
    title
    url_key
    content_heading
    content
    page_layout
    meta_title
    meta_keywords
    meta_description
  }
}

[2] To Display Home Page

{
  cmsPage(identifier: "home") {
    title
    url_key
    content_heading
    content
    page_layout
    meta_title
    meta_keywords
    meta_description
  }
}

[2] To Display About Us Page

{
  cmsPage(identifier: "about-us") {
    title
    url_key
    content_heading
    content
    page_layout
    meta_title
    meta_keywords
    meta_description
  }
}

[2] To Display Privacy Policy Page

{
  cmsPage(identifier: "privacy-policy-cookie-restriction-mode") {
    title
    url_key
    content_heading
    content
    page_layout
    meta_title
    meta_keywords
    meta_description
  }
}

[2] To Display “What are Cookies?” Page

{
  cmsPage(identifier: "enable-cookies") {
    title
    url_key
    content_heading
    content
    page_layout
    meta_title
    meta_keywords
    meta_description
  }
}

How To Get Home Page Using GraphQL in Magento 2.x

The following below Magento 2.x GraphQL Query

{
  storeConfig {
    cms_home_page
  }
}

We can also get by using below cmsPage GraphQL query

Syntax

cmsPage(identifier: String): CmsPage
{
  cmsPage(identifier: "home") {
    title
    url_key
    content_heading
    content
    page_layout
    meta_title
    meta_keywords
    meta_description
  }
}

How To Get Store Configuration Data Using GraphQL in Magento 2.x

The following below Magento 2.x GraphQL

storeConfig query is used to define information about a store’s configuration data

Syntax

storeConfig: StoreConfig

[1] – GraphQL To Get Store’s Configuration Data ::

Below GraphQL query display all Store’s Configuration Data

{
  storeConfig {
    id
    code
    website_id
    locale
    base_currency_code
    default_display_currency_code
    timezone
    weight_unit
    base_url
    base_link_url
    base_static_url
    base_media_url
    secure_base_url
    secure_base_link_url
    secure_base_static_url
    secure_base_media_url
    store_name
  }
}

[2] – GraphQL To Get Store’s Theme Data ::

Below GraphQL query display all Store’s Theme Data

{
  storeConfig {
    default_title
    default_keywords
    welcome
  }
}

[3] – GraphQL To Get Store’s CMS Configuration Data ::

Below GraphQL query display all Store’s CMS Configuration Data

{
  storeConfig {
    front
    cms_home_page
    no_route
    cms_no_route
    cms_no_cookies
    show_cms_breadcrumbs
  }
}

[4] – GraphQL To Get Store’s Catalog Configuration Data ::

Below GraphQL query display all Store’s Catalog Configuration Data

{
  storeConfig {
    product_url_suffix
    category_url_suffix
    title_separator
    list_mode
    grid_per_page_values
    list_per_page_values
    grid_per_page
    list_per_page
    catalog_default_sort_by
  }
}

[5] – GraphQL To Get Store’s Product Tax Configuration Data ::

Below GraphQL query display all Store’s Product Tax Configuration Data

{
  storeConfig {
    category_fixed_product_tax_display_setting
    product_fixed_product_tax_display_setting
    sales_fixed_product_tax_display_setting
  }
}

How To Setup Algolia in Magento 2.x

Algolia is an American company that provides fast web search results through Software-as-a-Service (SaaS) model, It is Hosted based search engine accessible via an API powering computer grade search for websites / app, Using Algolia, Users feel personalized site search &s a fast and reliable search experience.

The following below Algolia Search Features

[1] – Search  as a Service [SAAS]]

[2] – API Integrate with Real Time Search

[3] – Auto Complete / Auto Suggest

[4] – Accurate Results

[5] – Full Text Search

[6] – AI Based Search

[7] – Instant Search Result

[8] – Find Answer Faster

[9] – Full Text Search Result

[10] – Globally 70 Data Center

[11] – Highly Optimized & Consumer Grade Search

[12] – Fast Response Time & Relevant Results

Algolia for Magento 2.x available the following below plans

[1] Free Plans :: Only limited features available
[2] Paid plans :: All features available

The following below steps to integrate Algolia with Magento 2.x

Step [1] – Run the below composer require command

Path=Magento 2 Root Directory

composer require algolia/algoliasearch-magento-2

Step [2] – Run below command to enable AlgoliaSearch

php bin/magento module:enable Algolia_AlgoliaSearch
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy

Step [3] – Check composer.json on Magento 2.x Directory

Step [4] – Check below file on Magento 2.x Directory

.magento.env.md

Step [5] Magento 2.x Admin settings for Algolia

To configure the Magento 2.x admin Algolia configuration, need the following Algolia credentials:

Application ID
Search-only API key
Admin API key

You can find these credentials on the Algolia Dashboard, on the API Keys page from the menu.

Step [6] Go To STORES > Configuration, redirects on configuration.

Step [7] – Go To Left Side Panel Algolia > Search, It redirects below Algolia Search Panel.

Fill Application ID, Search-only API key, Admin API key from previous Step [5]

Step [8] – Once, Magento 2.x Aloglia Admin Configuration has been done, send the data in your Magento 2.x installation to Algolia using the indexing process.

For Algolia Indexing Process, run below CLI Command

php bin/magento indexer:reindex algolia_products algolia_categories algolia_pages algolia_suggestions algolia_additional_sections

Finally, Magento 2.x with Algolia Search has been configured

Which Magento 2.x Database Tables For Algolia Search, While Magento 2.x Connected To Algolia Search.

How To Get Customer Data By GraphQL Query in Magento 2.x

We are going to explain, Custom GraphQL Query Module to fetch the Customer’s Data in Magento 2.x to retrieve basic information of the customer entity as below

  • email
  • firstname
  • lastname
  • gender
  • dob
  • created_at

There are following below steps need to follow.

Customer GraphQL Query Module by using custom module

Here, we are considering as
Namespace / ModuleName = Mage2db / CustomerGraphQl

Step [1]  Create registration.php file under your module [ Namespace / ModuleName ]

File Path=Mage2db/CustomerGraphQl/registration.php

Add below content in this file.

<?php
/**
 * @author       John
 * @copyright    Copyright (c) 2022 (https://mage2db.com)
 * @package      CustomerGraphQl
 */
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Mage2db_CustomerGraphQl',
    __DIR__
);

Briefly Explain module.xml

Step [2] – Create module.xml file under your module [ Namespace / ModuleName ]

File Path=Mage2db/CustomerGraphQl/etc/module.xml

Add below content in this file.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Mage2db_CustomerGraphQl" setup_version="1.0.0">
        <sequence>
            <module name="Magento_GraphQl"/>
            <module name="Magento_Backend"/>
            <module name="Magento_CustomerGraphQl"/>
        </sequence>
    </module>
</config>

Briefly Explain registration.php

Our Module is depends on GraphQL and Customer GraphQL Module, we have given dependency on module.xml file.

Step [3] – Every GraphQl Module must contain schema.graphqls file under the etc folder of a module.

File Path=Mage2db/CustomerGraphQl/etc/schema.graphqls

Add below content in this file.

#Custom Module Customer GraphQL
type Query {

    customer_details(

    id: Int! @doc(description: "Specify The ID of The Customer.")

    ): CustomerData @resolver( class: "Mage2db\\CustomerGraphQl\\Model\\Resolver\\Customerlist") @doc(description: "Get list of Customer Data for the given customer id.")

}

type CustomerData {
        firstname: String
	lastname: String
	email: String
	gender: String
	dob: String
        city: String
	created_at: String
}

id: Int @doc(description: “Id of the Customer”) map to Stored Customers Listing id as Int type

Step [4] – Need to create Customerlist.php file from defined resolver from above schema.

CustomerData @resolver( class: “Mage2db\CustomerGraphQl\Model\Resolver\Customerlist”) @doc(description: “Get list of Customer Data for the given Customer ID.”)

Add below content in this file.

<?php
/**
 * @author       John
 * @email        johndusa1021@gmail.com
 * @copyright    Copyright (c) 2022 (https://mage2db.com)
 * @package      CustomerGraphQl
 */
namespace Mage2db\CustomerGraphQl\Model\Resolver;
 
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
use Magento\Store\Model\StoreManagerInterface;
 
class Customerlist implements ResolverInterface
{
	
        protected $_customerSession;
	protected $_customerFactory;
	protected $_addressFactory;
	protected $storeManager;
    
     /**
     * @param Field $field
     * @param \Magento\Framework\GraphQl\Query\Resolver\ContextInterface $context
     * @param ResolveInfo $info
     * @param array|null $value
     * @param array|null $args
     * @return array|\Magento\Framework\GraphQl\Query\Resolver\Value|mixed
     * @throws GraphQlInputException
     */
	 
	 public function __construct(
	 
     \Magento\Customer\Model\SessionFactory $customerSession,
     \Magento\Customer\Model\CustomerFactory $customerFactory,
     \Magento\Customer\Model\AddressFactory $addressFactory,
     \Magento\Framework\Url $url,
     StoreManagerInterface $storeManager
     )  
     {
	   $this->_customerSession = $customerSession->create();
           $this->_customerFactory = $customerFactory;
           $this->_addressFactory  = $addressFactory;
           $this->urlHelper = $url;
	   $this->storeManager = $storeManager;
          
      }
	 
    public function resolve(
        Field $field,
        $context,
        ResolveInfo $info,
        array $value = null,
        array $args = null)
    {
         $currentStoreId = $this->storeManager->getStore()->getId();

         $Customer_Collection = $this->_customerFactory->create()->load($args['id']);
		 		
		 return $Customer_Collection->getData();
    }
}

As per above script, resolve() method having script which is responsible for getting Customer GraphQl Data.

Step [5] – Finally your Customer GraphQl Query Module has been created

Run the following below commands at your Magento 2 root directory


php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush

Step [6] – Check your Customer GraphQl Query Module query response by installing chrome extension ChromeiQL or Altair GraphQL addon.

Here we have checked by ChromeiQl

How To Setup Magento 2.x Coding Standard

Coding Standard is a set of rules / regulations to specify Magento 2.xCoding Standard, every developer / designer must follow while a participating in the Magento 2.x Project Development / Designing.

Magento 2.x Coding Standard design Application’s Security, Stability, Maintainability and Extensibility (extend or modify existing behavior)

The following below steps need to follow.

Step [1] – Go to Magento 2 Root Directory & run below command

composer create-project magento/magento-coding-standard --stability=dev magento-coding-standard

Once successfully installed message as below

Config value “installed_paths” added successfully

Step [2] – Add below line in Magento 2 Root Directory composer.json

"scripts": {
	"post-install-cmd": [
	"([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/)"],
	"post-update-cmd": [
	"([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/)"]
	}

Step [3] – Run below command

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reindex
php bin/magento cache:flush

Step [4] – Verify Installation
Command should return the list of installed coding standards .
go inside magento-coding-standard

cd magento-coding-standard

Step [4.1] – Once go inside magento-coding-standard, Run below command

cd vendor\bin
phpcs -i

The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz, Zend, Magento2, Magento2Framework and PHPCompatibility

Finally Magento 2.x Coding Standard has been installed successfully.

Step [5] – Run Below command to check either Installed Magento 2 Coding Standard proper working or not

phpcs --standard=Magento2 D:/xampp/htdocs/VendorName/ModuleName or Particular File Path

Once running phpcs command Solution as
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
Everytime once running phpcs after that need to run below command always
vendor/bin/phpcbf –standard=Magento2 D:/xampp/htdocs/HNI/yourcustomModule or particular file
Once running above command, minor issue (Line indented Issue, Space Issue, Whitespace
Issue, End of Line Issue etc) auto resolved
Again need to run below command & resolve issue according instruction
vendor/bin/phpcs –standard=Magento2 D:/xampp/htdocs/HNI/yourcustomModule or particular file

In Magento 2.4.x or Adobe Commerce 2.4.x — Magento 2.x Coding Standard already inbuilt just need to run CLI command as below

Syntax::

AdobeCommerce Root-Directory vendor/bin/phpcbf --standard=Magento2 app/code/John/Quicksupport
root@fad926ccdc9b:/var/www/html/wwwroot/magento246# vendor/bin/phpcs --standard=Magento2 app/code/John/Mage2db
root@fad926ccdc9b:/var/www/html/wwwroot/magento246# vendor/bin/phpcbf --standard=Magento2 app/code/John/Mage2db

Magento 2.x Never Allow The Direct Use of The ObjectManager Code