I’m currently working on a Shopify theme & custom shopify app (an API-only app), and I have a specific requirement that I’m unsure of how to implement. I’d appreciate any guidance or insights you might have.
Objective:
- I want to add an email input field along with a submit button inside my Shopify theme.
- Once the submit button is clicked, I’d like to check if a customer with the entered email exists.
- If the customer does NOT exist:
- Create a new customer with the provided email.
- Automatically log the customer in.
My question then is: Is it possible to achieve the above using the new OTP-based account system?
I’m aware that something similar could be achieved (sort-of) with Shopify’s older account system. However, with the introduction of the new customer account system, I’m uncertain about how to go about this.
I also want to emphasize that the solution can involve calls to any shopify API, but only if the call is triggered by hitting an endpoint on a shopify using javascript embedded in the theme.
I would be grateful for any pointers, code samples, or relevant documentation links that could guide me.
Thank you in advance for your time and expertise!
I tried looking at the existing customer account API, which is relatively new, but it seems geared towards headless stores, which is not our case.