Overview
This article provides a guide on how to implement the Hydrogen Demo Store + Multipass Google Sign in and checkout persistence for Shopify. It includes instructions on how to persist the user session between Hydrogen and the checkout process, as well as how to enable external user authentication through Google Sign in. Please note that this implementation is not official and should be used at your own risk.
Features
- Checkout login persistence: Demonstrates how to persist the user session between Hydrogen and the checkout.
- External user authentication via Google Sign in: Allows users to login using their Google accounts and integrates with Shopify multipass.
Installation
To install the Hydrogen Demo Store + Multipass Google Sign in and checkout persistence, follow these steps:
- Add the necessary environment variables.
- Add the
MultipassCheckoutButtoncomponent to/app/components/MultipassCheckoutButton.tsx. - Add the
multipass.tsxhelper to/lib/multipass/multipass.tsx. - Add the
Multipassifyclass to/lib/multipass/multipassify.server.tsx. - Add the multipass token generation route to
app/routes/($lang)/account/__public/login.multipass.tsx. - Implement the
<MulitpassCheckoutButton />in the<Cart />component atapp/components/Cart.tsx. - For external user authentication via Google Sign in, add the necessary environment variables.
- Add the
GoogleSingInButtoncomponent toapp/components/GoogleLoginButton.tsx. - Add the
multipass.tsxhelper to/lib/multipass/multipass.tsx. - Add the
Multipassifyclass to/lib/multipass/multipassify.server.tsx. - Add the multipass token generation route to
app/routes/($lang)/account/__public/login.multipass.tsx. - Add the multipass token validation route to
app/routes/(%24lang)/account/__public/login.multipass.%24token.tsx. - Implement the
<GoogleSignIn />in the Google sign in login route (or/app/routes/account/login) inapp/components/Cart.tsx.
Summary
This article provides instructions on how to implement the Hydrogen Demo Store + Multipass Google Sign in and checkout persistence for Shopify. It demonstrates how to persist the user session between Hydrogen and the checkout process, as well as how to enable external user authentication via Google Sign in.