Shopify / ui-extensions

MIT License
264 stars 37 forks source link

Logged-in customer state is not carried to order status page using the new customer accounts #1614

Open ZhenyiZhang opened 9 months ago

ZhenyiZhang commented 9 months ago

Please list the package(s) involved in the issue, and include the version you are using

    "@shopify/app": "3.50.2",
    "@shopify/checkout-ui-extensions-react": "0.27.3",
    "@shopify/cli": "3.50.2",

Describe the bug

We discovered an issue of logged customer state is not carried to the order status page.

Steps to replicate:

  1. the store is using the new customer account
  2. make sure to log out any store accounts
  3. log in as a customer using the email during the checkout (eg. log in on the checkout information page)
  4. complete the checkout and land on the order status page

the customer logged-in state would be lost even through the customer has logged in from the earlier step.

This issue has been causing us not being able to get the customer data using useCustomer hook when developing order status page checkout extension.

As long as the customer exits the checkout flow and goes to the storefront pages, the logged-in state will be shown correctly and also available on OSP if we place a new order and land on order status page again.

Expected behaviour

The customer logged-in state should be shown correctly on order status page and the logged-in customer data should be available.

Screenshots

The screenshot below was taken on the order status page and the customer has logged in earlier on the information page.

Screenshot 2023-12-18 at 4 25 34 PM

Additional context

This issue is similar to a previous report https://github.com/Shopify/ui-extensions/issues/1587 but we're not sure if this has the same root cause.

brianshen1990 commented 9 months ago

Hey @ZhenyiZhang, according to the attached screenshot, the customer is not logged in to new customer accounts ( if a customer has already logged in, there will be a profile section )

Screenshot 2023-12-22 at 09 22 36

can you help to provide more details about this step 3. log in as a customer using the email during the checkout (eg. log in on the checkout information page) ?

If the merchant is using new customer accounts, logging in during checkout should mean going through the passwordless (use 6 digital code) login page, and being navigating back to the checkout page. Otherwise, the customer is not logged in to new customer accounts.

ZhenyiZhang commented 8 months ago

@brianshen1990 sorry for the late reply. I recorded a video to show the step of 3. log in as a customer using the email during the checkout (eg. log in on the checkout information page), and hopefully this can demonstrate the case better. Let me know if you need further explanations!

brianshen1990 commented 8 months ago

Hey @ZhenyiZhang , thanks for the video and I can reproduced it now, and will get back to you soon!

brianshen1990 commented 8 months ago

Hey @ZhenyiZhang , logging in during checkout means the customer is logged in to to both storefront and checkout, but not new customer accounts. When navigating from thankyou page to order status page, it is still regarded as not logged in. At this time, if we click orders or profile link from navigation menu, a redirection will happen and new customer accounts will be able to get the logged in state. But order status page is a little different, it doesn't need authentication, no redirection will happen, so when redirecting from thankyou page to order details page, the customer is regarded as not logged in.

We are trying to come up with a solution, and will get you updated!

ZhenyiZhang commented 8 months ago

Thank you so much @brianshen1990!

owenfranssen commented 8 months ago

When logging in to the new customer accounts, should the Storefront also see a user's signed in state?

ctrlaltdylan commented 4 months ago

I believe I'm also seeing this bug.

The useEmail() hook works, as well as the useOrder() hook, but the useCustomer() hook doesn't return any data:

Link to repro: https://github.com/Shopify/ui-extensions/issues/1904#issuecomment-2117739158

nickpinto commented 4 days ago

@romainshopify can we add this to our Lift and shift m1 backlog?