wp-graphql / wp-graphql-woocommerce

Add WooCommerce support and functionality to your WPGraphQL server
https://woographql.com
GNU General Public License v3.0
649 stars 130 forks source link

Password protected products break "products" response #879

Open JaidonLalor opened 3 months ago

JaidonLalor commented 3 months ago

Describe the bug I had two password protected products that broke my "products" query.

I got this message: { "errors": [ { "debugMessage": "Cannot return null for non-nullable field \"SimpleProduct.id\".", "message": "Internal server error", "extensions": { "category": "internal" }, "locations": [ { "line": 4, "column": 7 } ], "path": [ "products", "nodes", 10, "id" ] } ],

Manual Fix I made the 2 password protected products private, or moved them to drafts, and saved. Then queries resolve successfully.

To Reproduce I attempted to reproduce this twice. The first time I was unsuccessful and password protected products worked. I then had to re-clone the wordpress weeks later and came across the same issue. This time, adding a password to a product breaks it.

Expected behavior See all products except password protected products. Or see an error message notifying me to make my password protected products private, or a draft.

Screenshots Video demonstration: https://youtu.be/AfcBLyExVt4

Screenshot 2024-07-29 at 3 25 54 PM

Plugin Versions

kidunot89 commented 2 months ago

@JaidonLalor Yea this has been an issue for awhile now. An easy workaround is the active the Unsupported Product type option in the GraphQL Settings which should result in those private product being nulled out.