# Unable to fetch hidden tiers using get with filter

**URL:** <https://forum.ghost.org/t/unable-to-fetch-hidden-tiers-using-get-with-filter/42028>\
**Category:** Bugs\
**Created:** [October 18, 2023, 8:21pm UTC](https://forum.ghost.org/t/unable-to-fetch-hidden-tiers-using-get-with-filter/42028 "2023-10-18T20:21:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpaler](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/mpaler/32/26539_2.png) [@mpaler](https://forum.ghost.org/u/mpaler)\
**Post date:** [October 18, 2023, 8:21pm UTC](https://forum.ghost.org/t/unable-to-fetch-hidden-tiers-using-get-with-filter/42028/1 "2023-10-18T20:21:46Z")

</div>

**Issue Summary**

I’m trying to show “hidden” tiers on a custom template page.

I have the following in portal config:

 ![Screen Shot 2023-10-18 at 12.22.11 PM](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/0/e/0e5dbf2effe914892278c6c27f5250083d7c9f43.png)

I’m trying to fetch the unchecked tiers using the following:

```auto
{{#get "tiers" include="monthly_price,yearly_price,benefits" filter="visibility:none" limit="all"}}

```

But the query returns empty. If I change it to visibility:public, the two checked tiers show up.

All tiers show up when I hit the API endpoint directly, [http://127.0.0.1:2368/ghost/api/content/tiers/](http://127.0.0.1:2368/ghost/api/content/tiers/)

```auto
{
  "tiers": [
    {
      "id": "64d410421546084bb3c3f75e",
      "name": "Free",
      "description": null,
      "slug": "free",
      "active": true,
      "type": "free",
      "welcome_page_url": null,
      "created_at": "2023-08-09T22:16:34.000Z",
      "updated_at": "2023-08-09T22:16:34.000Z",
      "visibility": "public",
      "benefits": [
      ],
      "trial_days": 0
    },
    {
      "id": "64d410421546084bb3c3f75f",
      "name": "Supporter",
      "description": null,
      "slug": "default-product",
      "active": true,
      "type": "paid",
      "welcome_page_url": null,
      "created_at": "2023-08-09T22:16:34.000Z",
      "updated_at": "2023-10-17T23:22:34.000Z",
      "visibility": "public",
      "benefits": [
      ],
      "currency": "USD",
      "monthly_price": 400,
      "yearly_price": 4000,
      "trial_days": 0
    },
    {
      "id": "652f1750f2633823c3a0f875",
      "name": "Basic Sponsor",
      "description": null,
      "slug": "basic-sponsor",
      "active": true,
      "type": "paid",
      "welcome_page_url": null,
      "created_at": "2023-10-17T23:22:56.000Z",
      "updated_at": "2023-10-18T00:15:38.000Z",
      "visibility": "none",
      "benefits": [
      ],
      "currency": "USD",
      "monthly_price": 4000,
      "yearly_price": 35000,
      "trial_days": 0
    },
    {
      "id": "652f1765f2633823c3a0f879",
      "name": "Special Sponsor",
      "description": null,
      "slug": "special-sponsor",
      "active": true,
      "type": "paid",
      "welcome_page_url": null,
      "created_at": "2023-10-17T23:23:17.000Z",
      "updated_at": "2023-10-18T00:15:38.000Z",
      "visibility": "none",
      "benefits": [
      ],
      "currency": "USD",
      "monthly_price": 9900,
      "yearly_price": 80000,
      "trial_days": 0
    },
    {
      "id": "652f1779f2633823c3a0f87d",
      "name": "Global Sponsor",
      "description": null,
      "slug": "global-sponsor",
      "active": true,
      "type": "paid",
      "welcome_page_url": null,
      "created_at": "2023-10-17T23:23:37.000Z",
      "updated_at": "2023-10-18T00:15:38.000Z",
      "visibility": "none",
      "benefits": [
      ],
      "currency": "USD",
      "monthly_price": 49900,
      "yearly_price": 450000,
      "trial_days": 0
    }
  ],
  "meta": {
    "pagination": {
      "page": 1,
      "pages": 1,
      "limit": 5,
      "total": 5,
      "prev": null,
      "next": null
    }
  }
}

```

* * *

## Setup information

**Ghost Version**

v5.69.3

**Node.js Version**

v16.15.0

**How did you install Ghost?**

Self hosted, dev install

**Provide details of your host & operating system**

OSX

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [October 18, 2023, 9:01pm UTC](https://forum.ghost.org/t/unable-to-fetch-hidden-tiers-using-get-with-filter/42028/2 "2023-10-18T21:01:38Z")

</div>

Looks like either a bug or a documentation error! That is indeed what the docs say to do!

> **[Ghost Handlebars Theme Helpers: get](https://ghost.org/docs/themes/helpers/get/)**
>
> Make custom queries to the Ghost API using the get helper and fetch publicly available data. Read more about Ghost themes! 👻

---

<div class="post-metadata">

**Author:** ![RyanF](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/ryanf/32/17448_2.png) [@RyanF](https://forum.ghost.org/u/RyanF)\
**Post date:** [October 18, 2023, 9:07pm UTC](https://forum.ghost.org/t/unable-to-fetch-hidden-tiers-using-get-with-filter/42028/3 "2023-10-18T21:07:16Z")

</div>

Like @Cathy_Sarisky said, I don’t see anything going wrong in your code.

Can you add this code to your theme’s default.hbs file to help debug?

```plaintext
{{#get "tiers"}}
  {{log this}}
{{/get}}

```

Then, stop Ghost (`ghost stop`) and restart it in dev mode: `ghost run -D`. Finally, refresh your site and check the output in the console. All of your tiers will be listed with the corresponding `visibility` issues. Please share what it says!

---

<div class="post-metadata">

**Author:** ![mpaler](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/mpaler/32/26539_2.png) [@mpaler](https://forum.ghost.org/u/mpaler)\
**Post date:** [October 18, 2023, 10:49pm UTC](https://forum.ghost.org/t/unable-to-fetch-hidden-tiers-using-get-with-filter/42028/4 "2023-10-18T22:49:00Z")

</div>

hi @RyanF

Did as you suggested and see the following in my console on my _local installation_

```auto
{
  tiers: [
    {
      id: '64d410421546084bb3c3f75e',
      name: 'Free',
      description: null,
      slug: 'free',
      active: true,
      type: 'free',
      welcome_page_url: null,
      created_at: 2023-08-09T22:16:34.000Z,
      updated_at: 2023-08-09T22:16:34.000Z,
      visibility: 'public',
      benefits: [],
      trial_days: 0
    },
    {
      id: '64d410421546084bb3c3f75f',
      name: 'Supporter',
      description: null,
      slug: 'default-product',
      active: true,
      type: 'paid',
      welcome_page_url: null,
      created_at: 2023-08-09T22:16:34.000Z,
      updated_at: 2023-10-17T23:22:34.000Z,
      visibility: 'public',
      benefits: [],
      currency: 'USD',
      monthly_price: 400,
      yearly_price: 4000,
      trial_days: 0
    },
    {
      id: '652f1750f2633823c3a0f875',
      name: 'Basic Sponsor',
      description: null,
      slug: 'basic-sponsor',
      active: true,
      type: 'paid',
      welcome_page_url: null,
      created_at: 2023-10-17T23:22:56.000Z,
      updated_at: 2023-10-18T00:15:38.000Z,
      visibility: 'none',
      benefits: [],
      currency: 'USD',
      monthly_price: 4000,
      yearly_price: 35000,
      trial_days: 0
    },
    {
      id: '652f1765f2633823c3a0f879',
      name: 'Special Sponsor',
      description: null,
      slug: 'special-sponsor',
      active: true,
      type: 'paid',
      welcome_page_url: null,
      created_at: 2023-10-17T23:23:17.000Z,
      updated_at: 2023-10-18T00:15:38.000Z,
      visibility: 'none',
      benefits: [],
      currency: 'USD',
      monthly_price: 9900,
      yearly_price: 80000,
      trial_days: 0
    },
    {
      id: '652f1779f2633823c3a0f87d',
      name: 'Global Sponsor',
      description: null,
      slug: 'global-sponsor',
      active: true,
      type: 'paid',
      welcome_page_url: null,
      created_at: 2023-10-17T23:23:37.000Z,
      updated_at: 2023-10-18T00:15:38.000Z,
      visibility: 'none',
      benefits: [],
      currency: 'USD',
      monthly_price: 49900,
      yearly_price: 450000,
      trial_days: 0
    }
  ],
  meta: {
    pagination: { page: 1, pages: 1, limit: 5, total: 5, prev: null, next: null }
  },
  pagination: { page: 1, pages: 1, limit: 5, total: 5, prev: null, next: null }
}
[2023-10-18 22:39:46] INFO "GET /membership/" 200 153ms
[2023-10-18 22:39:47] INFO "GET /assets/css/screen.css?v=362b14e292" 304 40ms
[2023-10-18 22:39:47] INFO "GET /assets/css/swaylocks.css?v=362b14e292" 304 40ms
[2023-10-18 22:39:47] INFO "GET /assets/js/jquery-3.2.1.min.js?v=362b14e292" 304 40ms
[2023-10-18 22:39:47] INFO "GET /assets/js/global.js?v=362b14e292" 304 40ms
[2023-10-18 22:39:47] INFO "GET /assets/js/post.js?v=362b14e292" 304 9ms
[2023-10-18 22:39:47] INFO "GET /members/api/member/" 200 9ms
[2023-10-18 22:39:47] INFO "GET /rss/" 304 53ms
[2023-10-18 22:39:47] INFO "GET /ghost/api/content/tiers/?key=d4a35d92fa516bc4d4e255759b&limit=all&include=monthly_price,yearly_price,benefits" 304 47ms
[2023-10-18 22:39:47] INFO "GET /ghost/api/content/newsletters/?key=d4a35d92fa516bc4d4e255759b&limit=all" 304 52ms
[2023-10-18 22:39:47] INFO "GET /ghost/api/content/settings/?key=d4a35d92fa516bc4d4e255759b&limit=all" 304 66ms
[2023-10-18 22:40:18] INFO Worker for job "mentions-email-report" online
[2023-10-18 22:40:18] INFO Worker for job mentions-email-report sent a message: done

```

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [October 18, 2023, 11:06pm UTC](https://forum.ghost.org/t/unable-to-fetch-hidden-tiers-using-get-with-filter/42028/5 "2023-10-18T23:06:03Z")

</div>

Sure looks like they’re available!  
Can you share the code inside the get that isn’t giving results? Does it also not give results on the dev setup?

Same version of ghost?

---

<div class="post-metadata">

**Author:** ![mpaler](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/mpaler/32/26539_2.png) [@mpaler](https://forum.ghost.org/u/mpaler)\
**Post date:** [October 19, 2023, 2:06am UTC](https://forum.ghost.org/t/unable-to-fetch-hidden-tiers-using-get-with-filter/42028/6 "2023-10-19T02:06:29Z")

</div>

@Cathy_Sarisky glad to.

I’m using the Basho theme which does a bunch of nesting. Hard to believe that’s the issue, but I’ll continue to experiment on my side, until it’s confirmed this is a bug…

Here’s how the theme stack is set up. The code works, except for the get/filter in question…

Things start with a custom page template called custom-sponsorships.hbs (Note: I’m simplifying here where it makes sense.)

**custom-sponsorships.hbs**

```auto
{{!< default}}
{{#post}}
	<div class="post-section">
		{{>post_header sponsorship_page=true}}
	</div>
{{/post}}

```

**post\_header.hbs**

```auto
<div class="post-header{{>partial_mode}}">
  <!-- bunch of header stuff goes here removed for easier reading -->

  {{#if sponsorship_page}}
    {{>members/sponsor_tiers}}
  {{/if}}
</div>

```

**members/sponsor\_tiers.hbs**

```auto
<div class="membership-section global-padding">
  <div class="global-subtitle">
    <small class="global-subtitle-title">{{{t "See {start-bold}pricing plans{end-bold}" start-bold="<span>" end-bold="</span>"}}}</small>
  </div>
  <div class="membership-wrap global-radius{{#if feature_image}} global-bg-image" style="background-image: url({{feature_image}}){{/if}}">
    <div class="membership-switch" data-active-price="yearly">
      <button data-price="monthly">{{t "Monthly"}}</button>
      <button data-price="yearly">{{t "Yearly"}}</button>
    </div>
    <div class="membership-cards">
      {{^if @member}}
        {{#if sponsorship_page}}
          {{#get "tiers" include="benefits" filter="visibility:none"}}
            {{#foreach tiers}}
              <div class="membership-card">
                <div class="membership-card-content">
                  <div class="membership-card-label">{{name}}</div>
                  <h2 class="membership-card-price">{{t "$"}}0</h2>
                  {{#if description}}<p>{{description}}</p>{{/if}}
                  {{#if benefits}}
                  <div class="membership-card-list">
                    <ul>
                      {{#foreach benefits as |benefit|}}
                      <li>{{benefit}}</li>
                      {{/foreach}}
                    </ul>
                  </div>
                  {{/if}}
                </div>
                <a href="{{@site.url}}/signup/" class="membership-button global-button">{{t "Sign up for free"}}</a>
              </div>
            {{/foreach}}
          {{/get}}
        {{/if}}
      {{/if}}
      {{#get "tiers" include="monthly_price,yearly_price,benefits" filter="visibility:none" limit="all"}}
        {{#foreach tiers}}
          <div class="membership-card">
            <div class="membership-card-content">
              <div class="membership-card-label">{{name}}</div>
              <h2 class="membership-card-price" data-monthly>{{#if monthly_price}}{{price currency=currency}}{{price monthly_price}}{{else}}$0{{/if}}<span>/{{t "month"}}</span></h2>
              <h2 class="membership-card-price" data-yearly>{{#if yearly_price}}{{price currency=currency}}{{price yearly_price}}{{else}}$0{{/if}}<span>/{{t "year"}}</span></h2>
              {{#if description}}<p>{{description}}</p>{{/if}}
              {{#if benefits}}
              <div class="membership-card-list">
                <ul>
                  {{#foreach benefits as |benefit|}}
                  <li>{{benefit}}</li>
                  {{/foreach}}
                </ul>
              </div>
              {{/if}}
            </div>
            <a href="javascript:" data-portal="signup/{{id}}/monthly" class="membership-button global-button" data-monthly>{{t "Sign up now"}}</a>
            <a href="javascript:" data-portal="signup/{{id}}/yearly" class="membership-button global-button" data-yearly>{{t "Sign up now"}}</a>
          </div>
        {{/foreach}}
      {{/get}}
    </div>
  </div>
  {{^if @member}}
    {{#if sponsorship_page}}
      <small class="global-question">{{t "Already have an account?"}} <a href="{{@site.url}}/signin/">{{t "Sign in"}}</a></small>
    {{/if}}
  {{/if}}
</div>

```

---

<div class="post-metadata">

**Author:** ![mpaler](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/mpaler/32/26539_2.png) [@mpaler](https://forum.ghost.org/u/mpaler)\
**Post date:** [October 19, 2023, 2:21am UTC](https://forum.ghost.org/t/unable-to-fetch-hidden-tiers-using-get-with-filter/42028/7 "2023-10-19T02:21:43Z")

</div>

If that’s over complicating things…if I rewrite the custom-sponsorships.hbs like so:

```auto
{{!< default}}
{{#post}}
<div class="post-section">
  {{#get "tiers" include="monthly_price,yearly_price,benefits" filter="visibility:none" limit="all"}}
        {{#foreach tiers}}
          <div class="membership-card">
            <div class="membership-card-content">
              <div class="membership-card-label">{{name}}</div>
              <h2 class="membership-card-price" data-monthly>{{#if monthly_price}}{{price currency=currency}}{{price monthly_price}}{{else}}$0{{/if}}<span>/{{t "month"}}</span></h2>
              <h2 class="membership-card-price" data-yearly>{{#if yearly_price}}{{price currency=currency}}{{price yearly_price}}{{else}}$0{{/if}}<span>/{{t "year"}}</span></h2>
              {{#if description}}<p>{{description}}</p>{{/if}}
              {{#if benefits}}
              <div class="membership-card-list">
                <ul>
                  {{#foreach benefits as |benefit|}}
                  <li>{{benefit}}</li>
                  {{/foreach}}
                </ul>
              </div>
              {{/if}}
            </div>
            <a href="javascript:" data-portal="signup/{{id}}/monthly" class="membership-button global-button" data-monthly>{{t "Sign up now"}}</a>
            <a href="javascript:" data-portal="signup/{{id}}/yearly" class="membership-button global-button" data-yearly>{{t "Sign up now"}}</a>
          </div>
        {{/foreach}}
      {{/get}}
</div>
{{/post}}

```

I get no cards, but if I change `visibility:none` to `visibility:public` the public tiers show.

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [October 19, 2023, 7:41am UTC](https://forum.ghost.org/t/unable-to-fetch-hidden-tiers-using-get-with-filter/42028/8 "2023-10-19T07:41:13Z")

</div>

@mpaler `{{#foreach}}` will filter on `visibility` to avoid accidentally showing things which aren’t meant to be public.

It looks like it hasn’t been documented (cc @RyanF) but you should be able to override the default visibility filter with `{{#foreach visibility="all"}}` or `{{#foreach visibility="none"}}`

---

<div class="post-metadata">

**Author:** ![RyanF](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/ryanf/32/17448_2.png) [@RyanF](https://forum.ghost.org/u/RyanF)\
**Post date:** [October 19, 2023, 2:06pm UTC](https://forum.ghost.org/t/unable-to-fetch-hidden-tiers-using-get-with-filter/42028/9 "2023-10-19T14:06:40Z")

</div>

Updated the `foreach` docs to include the `visibility` attribute!

---

<div class="post-metadata">

**Author:** ![mpaler](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/mpaler/32/26539_2.png) [@mpaler](https://forum.ghost.org/u/mpaler)\
**Post date:** [October 19, 2023, 4:37pm UTC](https://forum.ghost.org/t/unable-to-fetch-hidden-tiers-using-get-with-filter/42028/10 "2023-10-19T16:37:53Z")

</div>

> [@Kevin](#):
>
> #foreach visibility=“none”

![](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/9/c/9cfcb2f897c7130e99b1701648bce019f50886ce.gif)  
Thank you…

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/2X/b/ba9ce5100b8bb264586f4f572545596b2ce3f081.png) [@system](https://forum.ghost.org/u/system)\
**Post date:** [January 17, 2024, 4:37pm UTC](https://forum.ghost.org/t/unable-to-fetch-hidden-tiers-using-get-with-filter/42028/11 "2024-01-17T16:37:54Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
