Buy Now and unlock this series
$
49
.99
yours forever
$
49
.99
Become a Pro and unlock everything
$
24
.99
per month
$
24
.99
Custom Snipcart Hook
We were able to successfully get Snipcart up and running on our original app, but as we might have noticed, we lose some of the functionality as we navigate between our new dynamic pages due to the clientside route changes. To solve this, we're going to learn how to create a custom React hook that we can use globally with the Context API that allows us to tap into Snipcart's state directly in order to make sure we're always displaying accurate and up-to-date order details.
Downloads
Become a pro to download code and videos
Ecommerce on the Jamstack with Snipcart, Next.js, & WordPress
16 videos
Released: July 31 2021Course Instructor
Colby Fayock
- Introduction
1m30s - NextJS
8m14s - Netlify & Github
15m46s - Sass, Components, Store Header
21m33s - Products, CSS Grid, Button component
22m39s - Snipcart, Env Variables
17m16s - WordPress, WPGraphQL
18m53s - GraphQL, Apollo Client
14m4s - Autodeploy with Web Hooks
5m50s - Dynamic Routes
19m27s - Custom Snipcart Hook
16m39s - Shared Layout
8m22s - Branding & Personality
23m26s - Snipcart Theming & Customization
24m13s - Custom Taxonomy
23m17s - Search
16m50s
Comments
Mike
9 months ago
Im having an issue with deploying with netlify. It was working previously but now I am being hit with an error when netlify tries to run npm run build.
Jac
about 1 year ago
Disregard previous comment, I was passing in the snipcart state into the snipcart context provider value prop incorrectly.
Jac
about 1 year ago
Having issues getting subtotal to update after implementing the useSnipcart hook. It seems the data for cart & subtotal is coming in after the Header component has rendered and the state is not updating as expected.
Want to join the conversation?
Become a Pro member today!