Shopify / js-buy-sdk

The JS Buy SDK is a lightweight library that allows you to build ecommerce into any website. It is based on Shopify's API and provides the ability to retrieve products and collections from your shop, add products to a cart, and checkout.

Home Page:https://shopify.github.io/js-buy-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove or disable email input when email is passed in the checkout.create method

razanor opened this issue · comments

Feature details

Currently, the email passed to the checkout.create method can be modified on the checkout page. Is it possible to remove or disable that input if an email is already passed?

A bit more context about our use case

We are using the customerAccessTokenCreateWithMultipass to retrieve an accessToken. This mutation also has a side-effect of creating a new customer if they do not exist. With that access token, we use the following query to retrieve customer orders:

query getcustomerOrders($customerAccessToken: String!) {
  customer(customerAccessToken: $customerAccessToken) {
    orders(first:100) {
    ...}
    ...}
...}

Basically, with this approach, we ensure that a signed-in user on our platform has a corresponding unique account in Shopify, and their orders are synced.

We are passing the user's email to the checkout.create method, and technically, that user could change the email in that input field. This action creates a brand new customer in Shopify and attaches their order to that account, resulting in a broken experience.

I understand that there are fields in the checkout that are required and can't be disabled, however I would expect if you passed the required field that your system rely on, it remains immutable.

This is indeed a challenge

Another concern relates to email validation during checkout creation

The SDK performs email validation before creating a checkout. If this validation fails, it prevents users from completing the checkout

While email verification is essential, it may sometimes flag valid emails as invalid. It would be beneficial to have an option to bypass this validation as well.