• Resolved darrenpaul

    (@darrenpaul)


    Hello.

    I’ve been going in circles with this issue.

    we are building a ecommerce site using Nuxt, WordPress, woocommerce and cocart. Everything thing works fine when a guest adds items to a cart. Everything works when when I add an item to the cart as a registered user (authenticate with email and password). The issues start when registered customers try to checkout. If that user logouts out and in again they lost all the sessions and cookies.

    How do I login customers from the nuxt side and how do I pass this session to WordPress, and woocommerce to get the user cart. If the user logs in on the checkout page everything works as intended, but we want the user to login from Nuxt.

    Would appreciate any feedback.

    kind regards

    Darren

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sébastien Dumont

    (@sebd86)

    Hi @darrenpaul

    If a customer has logged out only the cookie is destroyed. As for the session it should still remain and if for some reason the session is gone, if you have persistent cart left enabled which sounds like you do then the session will get created again.

    Now you mention that when on the checkout page everything is still working for a logged in customer so it doesn’t appear to be an issue with WooCommerce or CoCart so you need to review your Nuxt code to see what you maybe missing.

    Check the network logs, perhaps authentication is not being passed correctly.

    Thread Starter darrenpaul

    (@darrenpaul)

    Hey Sébastien

    Thanks for the response. After I created the ticket I realised I didn’t give a full context of whats going on.

    All the pages are being build using Nuxt, except Account and Checkout pages, those pages are WordPress pages.

    All the projects I’ve seen that are using Nuxt, WordPress, Woocomerce and Cocart have build these pages in Nuxt.

    Is it possible to have Nuxt and WordPress pages working together?
    Our Nuxt site is on domain http://www.example.com and the WordPress site is on cms.example.com.

    You mentioned perhaps authentication is not being passed correctly, how do I actually authentication a user using WordPress?

    currently I am using wp-json/cocart/v2/login to authenticate the user. We login from the Nuxt site with our own login page.
    Once this happens, I get the cart for that user.

    Sorry for all my questions, its my first time using WordPress, Woocomerce and Cocart as well as interacting with so many different services. I’m used to customer built solutions.

    Plugin Author Sébastien Dumont

    (@sebd86)

    Is it possible to have Nuxt and WordPress pages working together?

    Yes you can use both domains. There is a feature that allows you to load a cart session for guest customers.

    As for the authentication I guess I wasn’t clear. While you use the login endpoint to authenticate the user as a starting point you still need to authenticate on all endpoints for the cart for a registered customer.

    I also have a JWT token add-on that makes authentication more secure for storing credentials in your app. Instructions on usage is provided in description.

    If you are having a CORS issue you can install that add-on too. Simply activate.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Login cookies’ is closed to new replies.