wp-graphql-woocommerce
wp-graphql-woocommerce copied to clipboard
Post Comments not returning commentedOn value as object but null instead
Describe the bug I'm implementing wp comments with wp-graphql and they did work perfectly until I installed wp-graphql-woocommerce, what is not returning is commentedOn value it always returns null.
To Reproduce Execude Query:
query GetForumBySlug($slug: String!) { forumBy(slug: $slug) { ...ForumSingleItem __typename } } fragment ForumSingleItem on Forum { id databaseId title date content slug author { node { name __typename } __typename } comments(where: {parent: null, order: ASC, orderby: COMMENT_DATE}) { nodes { ...Comment } } } fragment Comment on Comment { id content databaseId date approved author { node { databaseId __typename } } commentedOn { node { id databaseId slug ... on Forum { id databaseId slug forumId } ... on Lesson { id databaseId slug lessonId } ... on Course { id databaseId slug courseId } } } commentOptions { author __typename } }
Expected behavior This is how it supposed to return data
{ "data": { "forumBy": { "id": "cG9zdDoyODc=", "databaseId": 287, "title": "qysh me ba pagesen e rrogave?", "date": "2021-06-02T00:10:52", "content": "
dskjfsjdkfjnskdf dsfsdf sdkfjsd fksdf ksdf
\n", "slug": "qysh-me-ba-pagesen-e-rrogave", "author": { "node": { "name": "malukiSuperAdmin", "__typename": "User" }, "__typename": "NodeWithAuthorToUserConnectionEdge" }, "comments": { "nodes": [ { "id": "Y29tbWVudDoyMDY=", "content": "go to top and do something
\n", "databaseId": 206, "date": "2021-06-01 22:12:10", "approved": true, "author": { "node": null }, "commentedOn": { "node": { "id": "cG9zdDoyODc=", "databaseId": 287, "slug": "qysh-me-ba-pagesen-e-rrogave", "forumId": 287 } } }, { "id": "Y29tbWVudDoyMDg=", "content": "test
\n", "databaseId": 208, "date": "2021-06-01 22:13:00", "approved": true, "author": { "node": null }, "commentedOn": { "node": { "id": "cG9zdDoyODc=", "databaseId": 287, "slug": "qysh-me-ba-pagesen-e-rrogave", "forumId": 287 } } } ] }, "__typename": "Forum" } }, "extensions": { "debug": [] } }
Screenshots
How it is supposed to work (without wp-graphql-woocomerce plugin activated)

How it is working (with wp-graphql-woocomerce plugin activated)

Plugin Versions
- WooGraphQL Version: 0.10.3
- WPGraphQL Version: 1.6.4
- WordPress Version: 5.8.1
- WooCommerce Version: 5.6.0
@jasonbahl @renatonascalves @jacobarriola @kidunot89
@shyqerigashi Not sure this is WooGraphQL issue.
Same problem with woocommerce
@shyqerigashi Not sure this is WooGraphQL issue.
please give example where this not return null
@AVert here is how it should look like
{ "id": "cG9zdDoxNDg4", "databaseId": 1488, "title": "TITLE....", "date": "2022-01-30T19:08:31", "content": "CONTENT.....", "slug": "eksporti-dhe-tvsh", "author": { "node": { "name": "NAME", "__typename": "User" }, "__typename": "NodeWithAuthorToUserConnectionEdge" }, "comments": { "nodes": [ { "id": "Y29tbWVudDozODc=", "content": "CONTENT.......", "databaseId": 387, "date": "2022-01-30 17:14:53", "approved": true, "author": { "node": { "databaseId": 7, "__typename": "User" }, "__typename": "CommentToCommenterConnectionEdge" }, "commentedPost": { "databaseId": 1488, "slug": "eksporti-dhe-tvsh", "__typename": "CustomCommentedPostOption" }, "commentOptions": { "author": null, "correctAnswer": null, "__typename": "Comment_Commentoptions" }, "replies": { "nodes": [], "__typename": "CommentToCommentConnection" }, "__typename": "Comment" } ], "__typename": "ForumToCommentConnection" }, "forumOptions": { "files": null, "__typename": "Forum_Forumoptions" }, "__typename": "Forum" }