Checkout Step 1: Enter Email
In this guide, you'll learn how to add an email step to the checkout flow. This typically would be the first step of the checkout flow, but you can also change the steps of the checkout flow as you see fit.
When the user enters their email, use the Update Cart API route to update the cart with the email.
Tip: If the customer is logged-in, you can pre-fill the email with the customer's email.
For example:
Tip:
- This example uses the
useCart
hook defined in the Cart React Context guide. - Learn how to install and configure the JS SDK in the JS SDK documentation.
After the customer enters and submits their email, you send a request to the Update Cart API route passing it the email in the request body.
Notice that if the cart doesn't have items, you should redirect to another page as the checkout requires at least one item in the cart. Redirecting to another page is not covered in this guide as this depends on the storefront framework you're using.
Was this page helpful?