Inquiry Regarding Custom Sections in Next.js and Shopify Integration

Shopify Partner
3 0 0

Hello Team,
I have come across an issue that pertains to website sections, a crucial element of any web platform. I am seeking your expertise on the following matters:

1. Incorporating Custom Sections, Specifically a Hero Section, into a Next.js Template:
I am interested in understanding the process of integrating a custom section, such as a Hero Section, into a
Next.js template. Your guidance on this would be greatly appreciated.

2.Integrating Custom Sections into a Shopify Store for User-Friendly Editing:
One of my primary objectives is to seamlessly incorporate these custom sections into a Shopify store, allowing
users to easily edit and customize them. Your insights on how to achieve this would be invaluable.

3. Utilizing GraphQL to Fetch Section Data, Particularly for Products:
I am also keen to explore the use of GraphQL to retrieve data for sections, such as products, by leveraging
categories and product attributes. I am interested in learning how to implement this functionality and display the
fetched data on my deployed website.

Any advice or potential solutions in this regard would be greatly appreciated.

Reply 1 (1)

Shopify Staff
2731 299 769


Here are some potential solutions for your queries:

  1. Custom Sections in a Next.js Template: To add a custom section like a Hero Section, you first need to create a new component in your components directory. This component will contain your HTML and CSS for the Hero section. Once the component is created, you can import it into your desired page or and use it as a normal React component. For example:
import HeroSection from '../components/HeroSection';

export default function HomePage() {
  return (
      <HeroSection />
      {/* Rest of your homepage */}
  1. Integrating Custom Sections into Shopify: Is this for sections that are within a Shopify theme (ie: not using Next,js) 

  2. Fetching Section Data with GraphQL: Shopify's Storefront API uses GraphQL for data requests. To fetch product data for a section, you would need to define your GraphQL query with the desired fields and attributes, and execute this query using Shopify's Storefront API. Here's an example of how you might do this:

import { gql } from "apollo-boost";

  query ProductData {
    shop {
      products(first: 5) {
        edges {
          node {
            priceRange {
              minVariantPrice {


You can then use this query with your preferred GraphQL client (like Apollo) to fetch and display data in your site.


Please note that these are just basic examples, and you might need to adjust the code according to your requirements. 


I hope this helps! Feel free to reach out if you have any other questions.

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit or the Shopify Web Design and Development Blog