Only display the first tier of categories I'm looking to only display the top level parent categories on my Template, but unfortunately, everything I try seems to error out and still display all of the children categories as well.

My current code looks like the following:

  {% set categories = craft.categories.group('discounts') %}
        {% for category in categories.all() %}
You can filter elements based on their hierarchy level with the level attribute

{% for category in categories.level(1).all() %} 


Will only show top tier categories

{% for category in categories.level(2).all() %}


only all the first tier children of all first tier categories (so tier 2) and so on.

Additional note 

You can also search for descendants elements

element.getDescendants(1) //&lt;-- include the level based on the parents level


With the parameter  1 it is the same as

element.getChildren()