• Resolved rupamshaw

    (@rupamshaw)


    Customer basic auth has done in postman(with customer userId and password)

    1.add cart via https://localhost/wp/wp-json/cocart/v1/add-item post request
    successful
    {
    “key”: “37693cfc748049e45d87b8c7d8b9aacd”,
    “product_id”: 23,
    “variation_id”: 0,
    “variation”: [],
    “quantity”: 1,
    “data”: {},
    “data_hash”: “b5c1d5ca8bae6d4896cf1807cdf763f0”,
    “line_tax_data”: {
    “subtotal”: [],
    “total”: []
    },
    “line_subtotal”: 1000,
    “line_subtotal_tax”: 0,
    “line_total”: 1000,
    “line_tax”: 0
    }

    2.get https://localhost/wp/wp-json/cocart/v1/get-cart returns

    {
    “37693cfc748049e45d87b8c7d8b9aacd”: {
    “key”: “37693cfc748049e45d87b8c7d8b9aacd”,
    “product_id”: 23,
    “variation_id”: 0,
    “variation”: [],
    “quantity”: 1,
    “data_hash”: “b5c1d5ca8bae6d4896cf1807cdf763f0”,
    “line_tax_data”: {
    “subtotal”: [],
    “total”: []
    },
    “line_subtotal”: 1000,
    “line_subtotal_tax”: 0,
    “line_total”: 1000,
    “line_tax”: 0,
    “data”: {},
    “product_name”: “A3 Premium Quality”,
    “product_title”: “A3 Premium Quality”,
    “product_price”: “$1,000.00”
    }
    }`

    3. login with customer https://127.0.0.1/wp/cart/
    -not showing cart.

    4. login with admin – cart can be seen.

    I tried with creating another user role customer but the cart is showing only in admin login, not for any customer login.

    I would like to use this endpoint in the react-native app. In-app with woocommerce rest API successfully created orders on the website.

    Please help me to resolve this.
    Thanks
    Rupam

    Note: Just I tried in postman with no auth for getting cart (shows cart item) and add cart(successful add).so by default its retrieving or adding a cart for the admin user. So I think, Please let me know how to do authentication for the user.

    • This topic was modified 5 years ago by rupamshaw.
    • This topic was modified 5 years ago by rupamshaw.
    • This topic was modified 5 years ago by rupamshaw.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter rupamshaw

    (@rupamshaw)

    resolved it by making Jwt token for users authentication .
    Now, cart creates as per session by username and password authhentication by its token https://localhost/wp/wp-json/cocart/v1/add-item post. is successful for creating items as per user.
    My assumption was with Basic Token(created by username and password ). it will create session.And I was wrong so successful session only created from Jwt token.

    Plugin Author Sébastien Dumont

    (@sebd86)

    Hi @rupamshaw

    I’m glad you managed to resolve your issue by yourself over the weekend. I’m hoping to have support for basic authentication in the next release.

    Basic authentication does not work well due to the cookie authentication check that WordPress has added.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add cart for role customer not showing in cart’ is closed to new replies.