How to create customer login session on Shopify store checkout from hydrogen application

How to create customer login session on Shopify store checkout from hydrogen application

neeraj_dang
Shopify Partner
8 0 0

We are building shopify hydrogen website and not able to redirect logged-in customers(with session) on shopify store checkout from hydrogen website.

Please let us know if there is a way to do so.

Replies 7 (7)

neeraj_dang
Shopify Partner
8 0 0

Just to add here. We have already tried the following things in order to achieve the loggedin customer session on Shopify store checkout while redirecting from hydrogen application.

1. Storefront APIs
--We tried to do this with storefront APIs(buyer cart identity) but there is no way to create store session on Shopify checkout
https://shopify.dev/api/storefront/2022-07/mutations/cartbuyeridentityupdate

2. Redirection to Shopify store checkout
--We tried this by passing customer and cart details in the URL parameters but it didn't work as required.
https://shopify.dev/custom-storefronts/checkout/create#associate-customers-to-web-checkouts

3. Hydrogen Cart Object
--We tried to create checkout URL with the help of hydrogen checkout hook but still its redirecting on checkout with cart details only but not with customer login session.
https://shopify.dev/api/hydrogen/hooks/cart/usecart

4. Multipass Feature (Shopify Plus)
--We can achieve this with Shopify plus multipass feature but it will work only for Shopify plus users. Whereas we need solution for all Shopify plan store customers.

 

Please suggest if there is any work around to achieve customer session on Shopify store checkout while redirecting user from hydrogen application cart.

Mladen_Terzic
Shopify Partner
18 1 4

hey there did you managed to solve this?

Shopify Expert
neeraj_dang
Shopify Partner
8 0 0

No luck yet!

Mladen_Terzic
Shopify Partner
18 1 4

In case anyone needs I think this could work: https://shopify.dev/custom-storefronts/building-with-the-storefront-api/checkout/create#associate-cu...

Mutation (if not using Multipass):
https://shopify.dev/api/storefront/2023-01/mutations/checkoutcustomerassociatev2

@neeraj_dang Let me know if this works for you

 

Shopify Expert
Daniel-katiek
Visitor
1 0 0

Were you able to find a workaround for this?

Mladen_Terzic
Shopify Partner
18 1 4

Yeah I believe the above solution I stated worked good for me

Shopify Expert
jfjarb
Visitor
1 0 0

Would you be able to share an example as to how you implemented that solution?