Previously, you created a new GraphCommerce app on your local machine. In this tutorial, you'll complete a series of tasks to add some specific functionality to your GraphCommerce storefront. Your final modification will be simple, but you’ll learn where to find resources to build more complex features on your own.
<Typography variant='h1' gutterBottom sx={{ textAlign: 'center' }}>
Hello
</Typography>
import { Typography } from '@mui/material'
to the list of imports at the
top of the file<Typography variant='h1' gutterBottom sx={{ textAlign: 'center' }}>
Hello
</Typography>
<Typography
variant='h1'
gutterBottom
sx={{ textAlign: 'center', backgroundColor: 'red' }}
>
Hello
</Typography>
You might want to make changes to a GraphQL query to fetch data from Magento for a specific need. For example, if you want to display a certain category property, you need to modify a query.
...CategoryQueryFragment
is included as a
fragment...CategoryQueryFragment
, remove the existing fragments and add
children_count
property:query CategoryPage($url: String!) {
...CategoryQueryFragment
categories(filters: { url_path: { eq: $url } }) {
items {
uid
children_count
}
}
}
{ "kind": "Field", "name": { "kind": "Name", "value": "children_count" } }
{category?.name} - ({category?.children_count})
You can explore the Storefront API and run test queries in your GraphCommerce app. When you're running the GraphCommerce local development environment, you can visit the following URL to load the GraphQL Explorer:
http://localhost:3000/api/graphql