Solved

Where do I set up heroBanners?

t2nosuke
Shopify Partner
4 2 0

I'm creating a demo store in Hydrogen.

 

I just got the heroBanners on the first page and it's empty.

Where on the shopify site do I set this up?

I can see the settings for 'featuredCollections' and 'featuredProducts', but I can't find any settings for 'heroBanners'.

I would appreciate it if someone could help me.

 

 

const HOMEPAGE_CONTENT_QUERY = gql`
  ${MEDIA_FRAGMENT}
  ${PRODUCT_CARD_FRAGMENT}
  query homepage($country: CountryCode, $language: LanguageCode)
  @inContext(country: $country, language: $language) {
    heroBanners: collections(
      first: 3
      query: "collection_type:custom"
      sortKey: UPDATED_AT
    ) {
      nodes {
        id
        handle
        title
        descriptionHtml
        heading: metafield(namespace: "hero", key: "title") {
          value
        }
        byline: metafield(namespace: "hero", key: "byline") {
          value
        }
        cta: metafield(namespace: "hero", key: "cta") {
          value
        }
        spread: metafield(namespace: "hero", key: "spread") {
          reference {
            ...Media
          }
        }
        spreadSecondary: metafield(namespace: "hero", key: "spread_secondary") {
          reference {
            ...Media
          }
        }
      }
    }
    featuredCollections: collections(
      first: 3
      query: "collection_type:smart"
      sortKey: UPDATED_AT
    ) {
      nodes {
        id
        title
        handle
        image {
          altText
          width
          height
          url
        }
      }
    }
    featuredProducts: products(first: 12) {
      nodes {
        ...ProductCard
      }
    }
  }
`

 

 

Results retrieved with GraphQL ↓

 

{
  heroBanners: { nodes: [] },
  featuredCollections: { nodes: [ [Object] ] },
  featuredProducts: { nodes: [ [Object], [Object], [Object] ] }
}

 

 

Accepted Solution (1)

t2nosuke
Shopify Partner
4 2 0

This is an accepted solution.

Resolved.

https://github.com/Shopify/hydrogen/discussions/1790

 

After setting this up, a meta field was added in the product collection.

I needed to image it there.

View solution in original post

Reply 1 (1)

t2nosuke
Shopify Partner
4 2 0

This is an accepted solution.

Resolved.

https://github.com/Shopify/hydrogen/discussions/1790

 

After setting this up, a meta field was added in the product collection.

I needed to image it there.