Git Product home page Git Product logo

Comments (13)

seb86 avatar seb86 commented on May 16, 2024

The documentation is outdated and I will get round to updating it when I can afford to spend time on it.

The API works with or without authentication but works best when not authenticating as a user. The API shows what you have in the cart, either added directly from your site or via the API.

The API acts just like the cart on the site. No more, no less.

from co-cart.

botoxparty avatar botoxparty commented on May 16, 2024

So this command http://domain.com/wp-json/wc/v2/cart/ -u consumer_key:consumer_secret would pull the cart for the user that i'm sending through?

from co-cart.

seb86 avatar seb86 commented on May 16, 2024

Correct

from co-cart.

botoxparty avatar botoxparty commented on May 16, 2024

Great, thanks seb. I'll try that out tomorrow.

Also happy to contribute to the docs, I'll let you know how it all goes.

from co-cart.

JosephCarrington avatar JosephCarrington commented on May 16, 2024

So in order to have an individual subscriber of our site have their cart accessed via the API, we would need to automatically generate each user a consumer_key and consumer_secret? Or have them authorize our app like this? http://woocommerce.github.io/woocommerce-rest-api-docs/images/woocommerce-auth-endpoint-flow.png

from co-cart.

botoxparty avatar botoxparty commented on May 16, 2024

@JosephCarrington yep exactly, i've written a function that generates the keys whenever a user registers in WordPress and stores them in their user info, and they are then passed in a JWT token to the client.

from co-cart.

BlueCloud02 avatar BlueCloud02 commented on May 16, 2024

I have just installed the plugin. But without the documentation, I have some problems.
I've tested the API with Postman and all works fine. But when I use it inside my website (without authentification), it is not working. (I am not creating my own web app but I want to use the API inside the initial wordpress-woocommerce website).
Do I have to use authentification? @botoxparty could you precise how you did that?

from co-cart.

seb86 avatar seb86 commented on May 16, 2024

@BlueCloud02 Documentation has moved. You can access it here: https://co-cart.github.io/co-cart-docs/

from co-cart.

botoxparty avatar botoxparty commented on May 16, 2024

@BlueCloud02 For users without authentication I store the responses from the API into localstorage and build the cart like that, if a user logs in then the cart in localstorage is merged into their account's cart.

Would be great if there was some way of the API keeping up with carts for unauthenticated users using a cookie or something even.. Feature request?

from co-cart.

seb86 avatar seb86 commented on May 16, 2024

The WooCommerce cart does use cookies and sessions. It's just encrypted as a hash, I think. You will have to use the cart normally and then look for what the value of the cookie WooCommerce saves to confirm.

from co-cart.

botoxparty avatar botoxparty commented on May 16, 2024

@seb86 Hmm i understand that the cart uses cookies and sessions however getting the API to refer to these particular sessions or cookies isn't documented. I'd be happy to help write the docs to perform these actions if you're willing to chat about it over slack or something?

This project has helped me a lot with my work and am very happy to contribute to driving it forward.

from co-cart.

seb86 avatar seb86 commented on May 16, 2024

@botoxparty The documentation is available here should wish to make a contribution but please know that I will be making some changes myself soon so you will have to keep an eye out for changes pushed.

Simply fork the repo and apply your contribution then make a pull request. I will then review and merge if all good.

Thank you.

from co-cart.

seb86 avatar seb86 commented on May 16, 2024

@botoxparty Sorry forgot to provide a link to the documentation. https://github.com/co-cart/co-cart-docs which I have just updated. More is to come but you are welcome to contribute to it now.

from co-cart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.