Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guest Account Checkout - Status 405 Not Allowed #222

Closed
kvindascr opened this issue Jan 28, 2020 · 11 comments
Closed

Guest Account Checkout - Status 405 Not Allowed #222

kvindascr opened this issue Jan 28, 2020 · 11 comments
Labels
awaiting author response Awaiting response from Issue/PR author

Comments

@kvindascr
Copy link

Describe the bug

Hello Guys, first of all, thanks a lot for this cool project.

I'm currently implementing a personal Ecom site with WooCommerce and using WpGraphql in the process.

I'm currently not supporting user accounts, and plan to only support Guest checkout.

Now on a guest session, when I execute the checkout method, I'm currently getting a 405 http status.

As far as I understood the checkout method should be the one called when trying to create a guest session order.

I would like to see if I can get any guidance to understand if I'm currently either doing something wrong or how to diagnose the issue.

To Reproduce
Steps to reproduce the behavior:

  1. Add some products to the cart by calling addToCart mutation.
  2. Cart query correctly retrieves cart content.
  3. When calling the checkout with all information (billing address, shipping address, shipping method, payment method) I get a 405 http status.
  4. As comment from the checkout input, I'm currently not sending the account portion, as I'm not interested on creating a user account.
  5. I'm currently creating the customer mutationId on my own with a uuid.
  6. Sessions are currently being handled via the wp-graphql token.

Expected behavior
Order should be created and no 405 returned.

Screenshots
Screen Shot 2020-01-28 at 17 25 42

Additional context
WooGraphql: v0.3.1-beta
Wp-graphql: v0.3.4

@kvindascr
Copy link
Author

Hello Guys,

I have been able to nail this down to not an issue when creating the order, rather when querying the Checkout operation result.

I still need to figure out which field in specific is causing the issue.

If I query the resulting Order, then I get the error.
At the moment I'm querying most of the fields of the order, so I need to nail down which one is specific is causing the problem.

@zamson
Copy link

zamson commented Jan 29, 2020

If I remember correctly (saw this somewhere), order creation must be done with a user that has edit-post capability.

@kidunot89
Copy link
Member

@kvindasAB Make sure you have guest checkout enable in the WooCommerce settings and have implemented retrieved and stash the woocommerce session took to send with your GraphQL request. Here is an example with React/Apollo

@kidunot89 kidunot89 added the awaiting author response Awaiting response from Issue/PR author label Feb 1, 2020
@kidunot89
Copy link
Member

@kvindasAB any update on this issue? Please note that the versions of WPGraphQL and WooGraphQL you have listed in the issue summary above aren't compatible.

@kvindascr
Copy link
Author

@kidunot89 I need to update on this issue.

After creating the issue I have updated to the latest versions of WPGraphQL and WooGraphQL, but can still replicate the issue.

But also after doing that I found an issue on my payload query, which I still want to discard if might be the one creating the situation in the first place.

But I still need a couple of days to confirm as I'm not on this project full time.

Will get back to you guys confirming either way, if the problem continues or was an issue on my side.

Will keep you posted.

@kvindascr
Copy link
Author

Guys I have not been able to check this.
I'm closing this ticket and re-opening it in case I confirm the issue is on WooGraphQL side.

Thanks.

@jasonbahl
Copy link
Collaborator

@kvindasAB hey, is your WordPress site at localhost:8000? The error 405 appears to be from hitting a non-existing URL with a POST request.

If you visit localhost:8000/graphql in your browser, what do you see?

@kvindascr
Copy link
Author

kvindascr commented Feb 18, 2020 via email

@jasonbahl
Copy link
Collaborator

Your screenshot shows that you're making requests to localhost:8000/graphql

When using Gatsby, the Gatsby GraphQL API only exists during build time and shuts down when the build is complete. It's not a live API you can query at runtime.

To make client-side GraphQL Queries/Mutations back to WordPress, you'll need to make the requests to the WordPress GraphQL API endpoint, not the Gatsby endpoint.

@kvindascr
Copy link
Author

kvindascr commented Feb 18, 2020 via email

@jasonbahl
Copy link
Collaborator

The error 405 that you're seeing, I believe, is an error you'll get when attempting a POST request against a non-existent endpoint.

Which makes it seem, to me, that you're attempting to query an endpoint that may not actually exist.

Could you share screenshots showing the requests to localhost:8000/graphql that are succeeding?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting author response Awaiting response from Issue/PR author
Projects
None yet
Development

No branches or pull requests

4 participants