Skip to content

Cache or auto-reference to previously Identify Buyer (not logged in) #166

@vanhai989

Description

@vanhai989

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

Do you have reproducible example code?

import {ColorScheme, ShopifyCheckoutSheet} from '@shopify/checkout-sheet-kit';

const config = {};

export const shopifyCheckout = new ShopifyCheckoutSheet({
  ...config
});

export class SheetKit {

  constructor() {
    this.init()
  }

  shopifyCheckout = null

  init = () => {
    this.shopifyCheckout = new ShopifyCheckoutSheet({
      ...config
    });

    this.shopifyCheckout.addEventListener('close', () => {
    })

    this.shopifyCheckout.addEventListener('error', (error) => {
      console.log('error', error);
    })

    this.shopifyCheckout.addEventListener('pixel', (pixel) => {
    })

    this.shopifyCheckout.addEventListener('completed', (event) => {
      console.log('event', event);
    })
  }
}

// Create cart

   const handleCreateCart = async (email, customerAccessToken, isStoreCartID = true) => {
        const { data: createCartData, error } = await createCart({
            variables: {
                input: {
                    buyerIdentity: { 
                        email: email || undefined , 
                        customerAccessToken: customerAccessToken || undefined
                    },
                    attributes: cartDiscountAttribute.customAttributes,
                }
            }
        })}


// call checkout function
    Identify.sheetKit.shopifyCheckout.present(cartStore.checkoutUrl);

Steps to Reproduce

step 1. login with an account A, create cart with it's email + accesstoken
step 2. checkout by checkout-sheet-kit (correct buyer information, email and addresses)
step 3. logout -> create new cart with undefined email and undefined accesstoken
step 4. checkout by checkout-sheet-kit (it auto-filled previous buyer infomation)

Expected Behavior

expected no-cache and no auto-fill with guest user

Actual Behavior

cached or auto-reference to previous buyer checkout when checkout with new guest cart

Storefront domain

non domain related

Screenshots/Videos/Log output

non media related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions