Skip to content

Checkout opens without associated buyer identity #197

@ghost

Description

What area is the issue related to?

Checkout Sheet Kit

What platform does the issue affect?

All platforms

What version of @shopify/checkout-sheet-kit are you using?

3.2.0 - Multiple Devices

Do you have reproducible example code?

Yes, though it is not consistently reproducible.

// Function to regenerate the checkout URL
const cart = await cartBuyerIdentityUpdateLite({
  customerAccessToken,
  email,
  phone
});
const checkoutUrl = cart?.cart?.checkoutUrl;
return shopifyCheckout.presentCheckout(checkoutUrl);
// Helper to update buyer identity and get new checkout URL
export async function cartBuyerIdentityUpdateLite(input: {
  customerAccessToken: string;
  email?: string;
  phone?: string;
}) {
  const currentCart = appStorage()?.currentCart ?? {};
  if (currentCart.id && input.customerAccessToken) {
    const variables: CartBuyerIdentityUpdateMutationVariables = {
      lite: true,
      cartId: currentCart.id,
      buyerIdentity: {
        customerAccessToken: input.customerAccessToken,
        ...(input.email && { email: input.email }),
        ...(input.phone && { phone: input.phone }),
      },
    };
    const result = await runTanstackQueryMutation<
      CartBuyerIdentityUpdateMutation,
      CartBuyerIdentityUpdateMutationVariables
    >(CartBuyerIdentityUpdateDocument, variables, useCartBuyerIdentityUpdateMutation.getKey());

    return { cart: result?.cartBuyerIdentityUpdate?.cart };
  }
}
# GQL Mutation
mutation cartBuyerIdentityUpdate(
  $cartId: ID!,
  $buyerIdentity: CartBuyerIdentityInput!,
  $collectionsFirst: Int = 0,
  $lite: Boolean = false
) {
  cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
    cart {
      ...cartResponse @skip(if: $lite)
      checkoutUrl @include(if: $lite)
      id @include(if: $lite)
    }
    userErrors {
      ...cartError
    }
  }
}

Steps to Reproduce

  • Run the app in a production environment (release build).
  • Ensure a valid cart is present, with buyer identity added using cartBuyerIdentityUpdate.
  • Call shopifyCheckout.presentCheckout(checkoutUrl).
  • Occasionally, the opened checkout is missing the buyer identity, and the user is prompted to log in.

Expected Behavior

Checkout presented via Sheet Kit should respect the buyer identity, and the user should remain logged in within the checkout session.

Actual Behavior

Sporadically (and only in production builds), the Sheet Kit presents a checkout screen that:

  • Does not reflect the authenticated buyer identity.
  • Prompts the user to log in again (Within the checkout sheet webview), even though a valid customerAccessToken was passed to the mutation.
  • This happens even though the cartBuyerIdentityUpdate mutation succeeds and returns a fresh URL.

Storefront domain

https://rforrabbit1.myshopify.com

Screenshots/Videos/Log output

rec.mov
  • This issue could not be reproduced in development mode.
  • Video recording attached shows a clear instance where:
    • A valid mutation is fired.
    • A new checkoutUrl is returned and passed to the Sheet Kit.
    • The resulting checkout still asks the user to log in.
  • We suspect a timing/race issue, or internal caching behavior in the Sheet Kit or web checkout instance.
  • No errors are returned from the mutation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingstale

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions