Skip to content

querying acf relationship fields between CPT and Product returns an error #565

Not planned
@vstrelianyi

Description

@vstrelianyi

versions:
WP 5.8.1
Woo 5.8.0
Graphql 1.6.5
WPGraphQL WooCommerce 0.10.4
Advanced Custom Fields PRO 5.10.2
WPGraphQL for Advanced Custom Fields 0.5.3

Steps:

  1. I'm having a CPT - Auctions
  2. Auction has an ACF Relationship field with Products
  3. when I'm running the following query - I'm receiving an error

QUERY:
image

ERROR:
image

QUERY:
query GET_AUCTIONS {
auctions {
nodes {
title
acf_auctions {
auctionProduct {
... on SimpleProduct {
id
name
databaseId
commentCount
}
}
}
}
}
}

ERROR:
{
"errors": [
{
"message": "Internal server error",
"extensions": {
"category": "internal"
},
"locations": [
{
"line": 6,
"column": 9
}
],
"path": [
"auctions",
"nodes",
1,
"acf_auctions",
"auctionProduct",
0
]
}
],
"data": {
"auctions": {
"nodes": [
{
"title": "Auction 2",
"acf_auctions": {
"auctionProduct": null
}
},
{
"title": "Auction 1",
"acf_auctions": {
"auctionProduct": [
null
]
}
}
]
}
},
"extensions": {
"debug": [
{
"type": "DEBUG_LOGS_INACTIVE",
"message": "GraphQL Debug logging is not active. To see debug logs, GRAPHQL_DEBUG must be enabled."
}
]
}
}

Activity

ardiewen

ardiewen commented on Oct 18, 2021

@ardiewen
Contributor

Hi @vstrelianyi can you post your Custom Field configuration? I'm wondering if you have the Select multiple values? option enabled.

vstrelianyi

vstrelianyi commented on Oct 18, 2021

@vstrelianyi
Author

Hi @ardiewen !
should I check for this option in ACF field configuration?

vstrelianyi

vstrelianyi commented on Oct 18, 2021

@vstrelianyi
Author

image

vstrelianyi

vstrelianyi commented on Oct 18, 2021

@vstrelianyi
Author

yes, you can select several options
image

vstrelianyi

vstrelianyi commented on Oct 18, 2021

@vstrelianyi
Author

btw I have found the same issue here in acf graphql plugin repo
wp-graphql/wp-graphql-acf#155

ardiewen

ardiewen commented on Oct 18, 2021

@ardiewen
Contributor

Yeah interesting... definitely related to the acf schema filter as mentioned in the other post. However the solve seems to be on this repo. I will see if I can test a potential fix.

vstrelianyi

vstrelianyi commented on Oct 18, 2021

@vstrelianyi
Author

That would be great! Thx a lot!

ardiewen

ardiewen commented on Oct 19, 2021

@ardiewen
Contributor

Hi @vstrelianyi, you'll need two PRs to fix the issue:

#568 on this repo
wp-graphql/wp-graphql-acf#297 on the acf plugin repo

Please note the following:

  1. This will only be a temp fix due to significant breaking changes in wp-graphql-acf in v0.6.0

  2. You MUST set a "Filter by Post Type" like you have in your screenshot. Failing to do so will cause the default type of your field to become PostObjectUnion which will cause conflicts with wp-graphql-woocommerce and consequently throw an error.

vstrelianyi

vstrelianyi commented on Oct 19, 2021

@vstrelianyi
Author

Ok. will try that!, thx!
so wp-graphql-acf v0.6.0 is on the way?

added
bugSomething isn't working
duplicateThis issue or pull request already exists
on Jan 13, 2022
CesarBenavides777

CesarBenavides777 commented on Sep 24, 2022

@CesarBenavides777

Hi @vstrelianyi, you'll need two PRs to fix the issue:

#568 on this repo wp-graphql/wp-graphql-acf#297 on the acf plugin repo

Please note the following:

  1. This will only be a temp fix due to significant breaking changes in wp-graphql-acf in v0.6.0
  2. You MUST set a "Filter by Post Type" like you have in your screenshot. Failing to do so will cause the default type of your field to become PostObjectUnion which will cause conflicts with wp-graphql-woocommerce and consequently throw an error.

I think only https://github.com/wp-graphql/wp-graphql-acf/pull/297 on the acf plugin repo this edit is needed now thankfully.

kidunot89

kidunot89 commented on Feb 7, 2023

@kidunot89
Collaborator

@vstrelianyi @CesarBenavides777 @ardiewen @asmartbear Is this still an issue in v0.12.1?

3 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @kidunot89@vstrelianyi@CesarBenavides777@ardiewen

      Issue actions

        querying acf relationship fields between CPT and Product returns an error · Issue #565 · wp-graphql/wp-graphql-woocommerce