• Hello,

    I am trying to use this plugin to manage cart items via API.
    I cannot seem to add products to a cart. It keeps returning an error:

    data: {
    ????code: ‘rest_missing_callback_param’,
    ????message: ‘Missing parameters: id’,
    ????data: { status: 400, params: [Array] }
    ??}

    Id is passed with the request.

    Any ideas?

    Best regards, Alen

    The page I need help with: [log in to see the link]

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

    (@sebd86)

    Hey @asvigelj

    If it’s not an issue, could you share what your doing to get that response?

    WordPress is pretty smart in returning the correct error if it’s wrong. You could be making a simple typo mistake.

    Thread Starter asvigelj

    (@asvigelj)

    {
    “prodict _id”: “42607”,
    “quantity”: “1”
    }

    Thank you for quick reply.
    I hope this helps us to solve this issue.

    Best regards, Alen.

    Plugin Author Sébastien Dumont

    (@sebd86)

    Can you confirm that CoCart is working in Postman or Insomnia with the Authentication?

    Thread Starter asvigelj

    (@asvigelj)

    Dear Sébastien,

    We can read cart content and delete cart content without a problem.

    Best regards, Alen.

    Plugin Author Sébastien Dumont

    (@sebd86)

    So is that a yes to my question? Because I’m trying to determine the route of the issue.

    Can you add an item without authentication?

    Thread Starter asvigelj

    (@asvigelj)

    We have tested without authorisation header and the same error got returned.

    Plugin Author Sébastien Dumont

    (@sebd86)

    I have tested several times my self and I am not able to replicate the issue unless I actually remove the ID parameter to get the error response.

    Please check your code and try again.

    Again, I will ask you to confirm that CoCart is working in Postman or Insomnia application instead of testing with CoCart JS Library so we may see if the issue lies with it only.

    Thread Starter asvigelj

    (@asvigelj)

    Dear Sir,

    Adding product works from POSTMAN.
    It does not work when we send request using our SDK that is made in js / node.js.

    Thank you for your help. Any Ideas on what we might be doing wrong?

    Best regards, Alen.

    Thread Starter asvigelj

    (@asvigelj)

    So I am guessing that we can not expect any help from your side with that?

    Best regards, Alen.

    Plugin Author CoCart Headless

    (@cocartforwc)

    @asvigelj

    You said “It does not work when we send request using our SDK that is made in js / node.js.” so I assumed you were talking about your SDK but you don’t show any more code or JSLint errors, yet, you expect me to have an idea on what might be wrong.

    If you don’t provide me with actual detailed information, I am very limited to what I can do to help.

    We know that CoCart is working fine in Postman, you have confirmed that and I have confirmed the CoCart JS SDK is working with no issues so I can only assume it’s related to your authentication.

    Thread Starter asvigelj

    (@asvigelj)

    I appologize. I am a link between you and our programmer.
    He said he is using your SDK.

    What should I send you so you get all the information you need to investigate?

    Best regards, Alen.

    Plugin Author CoCart Headless

    (@cocartforwc)

    I take it you are using a JWT Authentication plugin with CoCart and is possibly the reason it is failing if the ID parameter is now working.

    I just launched my own JWT Authentication plugin designed to work with CoCart. I’d appreciate it if you can ask your developer to try it out and let me know if that solves the issue.

    Thread Starter asvigelj

    (@asvigelj)

    Dear Sébastien,

    We installed your new plugin to a staging enviroment of our wordpress.

    All the relevant plugins on the stage enviroment were updated.

    We receive an error when requesting getCart API endpoint over CoCart SDK :
    {
    ??code: 'cocart_jwt_authentication_error',
    ??message: 'Authentication is invalid. Please check the authentication information is correct and try again. Authentication also only works on a secure connection.',
    ??data: { status: 401 }
    }

    Before updating jwt authentication plugin to the latest version we were getting error missing parameter ID.

    We are getting the token over wp-json/jwt-auth/v1/login endpoint.

    Anyhow I created an admin user "cocart" with password z2LOIKsZ(2I9ov9@j1Q(xkIE
    You can login / check yourself on the url https://stage.selsen.si/wp-admin

    Any assistance is apprecicated.


    Plugin Author Sébastien Dumont

    (@sebd86)

    Your latest error is because you didn’t use the login endpoint in CoCart. I have tested JWT authentication and it does work as it should.

    I was this time able to replicate the issue with CoCart SDK JS. Something to do with axiosConfig being used so I would refrain using the SDK for now until the issue can be solved. CoCart’s API is working fine without it.

    Thread Starter asvigelj

    (@asvigelj)

    Thank you very much for your answer.

    Could you tell me what is the correct login endpoint in CoCart?

    We were reading instructions and could not find anything else than https://docs.cocart.xyz/#login and this returns logged in user data not any kind of token.

    Also our programer is curious if the problem lies in axiosConfig how other functions (get cart, remove item from cart) are working properly via SDK?

    Also without Cocart JWT plugin adding to cart function works via direct http request so I guess we won’t be needing that extra plugin?

    Thank you very much for all your help.

    Best regards, Alen.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Cannot add product to cart.’ is closed to new replies.