Comments (20)
Hello!
I'm using WPGraphQL 1.0.1, WPGraphQL for Advanced Custom Fields 0.3.4, and WooGraphQL 0.7.0 and it seems this still an issue. I have an ACF Block with a Relationship field that takes Products only and it always returns the message: value \" instance of WPGraphQL\\Model\\Post\", received \"Product\". Either type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function.",
.
Anyone has been able to make it work?
from wp-graphql-acf.
@Nessario I believe @kidunot89 released a new version of WPGraphQL for WooCommerce to play nice with WPGraphQL for ACF v0.3.0. . .perhaps it's a version mis-match issue?
What version of WPGraphQL, WPGraphQL for ACF and WPGraphQL for WooCommerce are you on?
from wp-graphql-acf.
@tkorsback hey, how are you registering these relationships? Using a plugin like Posts 2 Posts or something?
from wp-graphql-acf.
@jasonbahl Yeah I use Posts 2 Posts for a few CPT relations and that works. The relation that doesn't work it a regular "post_object" relation with no other relation sharing it's name.
from wp-graphql-acf.
Ya, to my knowledge, nobody has written any plugin that converts Post 2 Post relationships to the GraphQL Schema.
I think it would be a super valuable plugin though! But there's for sure work that would need to be done to use the Post 2 Post registry and map it to the WPGraphQL Schema.
from wp-graphql-acf.
@jasonbahl But the Posts 2 Posts relations work and shows up in GraphiQL. It's the acf relation to WooCommerce that doesn't show.
from wp-graphql-acf.
π€I thought your issue above was a snippet of your posts 2 posts registry, and you're asking why it's not working?
I guess I'm not sure what you're asking then.
from wp-graphql-acf.
Maybe provide more code snippets and screenshots of GraphiQL or something so I can understand better what you're after.
from wp-graphql-acf.
Sure!
CPT: Membership
ACF relation to CPT Company (working):
[
'key' => 'field_membership_company_relationship',
'name' => 'company_membership',
'label' => __('Company', 'tp-cpt'),
'type' => 'post_object',
'post_type' => [
'tp_company'
],
'show_in_graphql' => true,
]
ACF relation to WooCommerce product (not working)
[
'key' => 'field_membership_product_relationship',
'name' => 'product_membership',
'label' => __('Product', 'tp-cpt'),
'type' => 'post_object',
'post_type' => [
'product'
],
'show_in_graphql' => true,
]
GraphiQL: Expanding Place nodes and then MembershipRelations I only see the Company relation, not the Product relation.
from wp-graphql-acf.
Ahhh!
I thought this was Posts 2 Posts code, not ACF code π€¦ββ
Sorry for that confusion!
Yes, this is a known issue right now, because the WPGraphQL for WooCommerce registers the Product post type manually, instead of making use of registering it from the post type registry, so ACF doesn't know that Product is a post type registered to the GraphQL Schema.
@kidunot89 opened a PR over the weekend to address this.
I'm reviewing today and hopefully we can have this resolved here soon.
Sorry again for the confusion π€¦ββ
from wp-graphql-acf.
No worries π
Ah ok, I understand. Nice work! π
from wp-graphql-acf.
I'm experiencing the same issue here, though by upgrading into the v0.4.0 the fields now show up in GraphiQL. But, those won't return any result π€
from wp-graphql-acf.
@Nessario can you provide more specific details about your scenario so I can replicate and debug?
from wp-graphql-acf.
@jasonbahl Yeah sure, below is a screenshot of the query.
Tested these same fields with other post types, they work fine.
from wp-graphql-acf.
@jasonbahl I just upgraded to the latest versions of all the mentioned plugins. Now, I'm noticing even the custom taxonomies, registered via CPT UI are missing (WPGraphQL CPT UI is also up to date). I'm experiencing this issue only with the Products post type of Woocommerce, the other post types work perfectly.
from wp-graphql-acf.
@kidunot89 did you ever get relationship field to work? I'm getting an internal server error notice when trying to query for ACF relationship fields with post type product. Pages and posts works fine but not WooCommerce products.
https://share.getcloudapp.com/xQugZEXB
I'm on version 0.4.4 of wp-graphql-woocommerce and 0.6.1 of wp-graphql
from wp-graphql-acf.
Seeing this same issue. I have a CPT 'Artists' registered via custom plugin and have ACF Relationship field 'Release' that I use to choose what WooCommerce product the Artist is associated with.
(The CPT is artists
and the ACF Field Group is also artists
).
In GraphiQL, the fields show up but nothing is returned and it generates an error:
Query:
{
artists { // CPT
nodes {
artists { // ACF Field Group
release {
... on SimpleProduct {
id
name
}
}
}
}
}
}
Result:
"errors": [
{
"message": "Internal server error",
"category": "internal",
"locations": [
{
"line": 5,
"column": 9
}
],
"path": [
"artists",
"nodes",
0,
"artists",
"release",
0
]
},
//...
I'll probably end up just using a Select field with all the releases in a drop-down as a workaround since I only really need the slug for the time being but it would be great if this worked.
from wp-graphql-acf.
ππ» WPGraphQL for ACF has been re-built over here: https://github.com/wp-graphql/wpgraphql-acf and it has significant improvements to loading data.
I'd be curious to here if anyone that's using WooCommerce + ACF + WPGraphQL has had a chance to use the new version of WPGraphQL for ACF and what your experience has been.
I'm inclined to believe a lot of things are working better, but there's definitely likely edge cases when all the various plugins collide.
from wp-graphql-acf.
@jasonbahl I've been working on a project with the latest WPGraphQL stack (ACF & WooGraphQL included) and it's been working pretty good so far ππΌπ€πΌ
Thanks for all the work you and the others have put into this ππΌ
from wp-graphql-acf.
Based on how old this is and the report above that the latest WPGraphQL for ACF + WooCommerce + WooGraphQL are working together, I'm going to close this.
This repo will be archived in the not-too-distant future in favor of the re-architected version of the plugin: https://github.com/wp-graphql/wpgraphql-acf, so if you have any new issues after updating to the latest WPGraphQL for ACF, please report over there ππ»
from wp-graphql-acf.
Related Issues (20)
- High CPU usage for get_location_rules() inside `add_acf_fields_to_graphql_types` HOT 2
- Querying for a custom post type by one of it's ACF field values HOT 2
- Fetching Data from User Relationship Field Returns Null HOT 3
- Get all the ACF fields object HOT 1
- Empty response when content includes non-allowed HTML tag HOT 2
- Get formatted ACF field data HOT 2
- PHP Deprecated: Optional parameter $and_params declared before required parameter $param HOT 2
- Getting GraphQL-Error if PostObject is null HOT 1
- Both WPGraphQL (v0.4.0+) and Advanced Custom Fields (v5.7+) must be active for "wp-graphql-acf" to work HOT 1
- ACF fields is not showing in graphiql IDE HOT 4
- GraphQL not working when defining sub options page HOT 3
- Using a date sub_field nested in a repeater as a filter / sorting method ? HOT 1
- ACF Taxonomy & Custom Field filtering HOT 2
- Where condition for ACF doesn't work....??? HOT 2
- Query on Taxonomy gives error on graphql response HOT 3
- Post object as draft return null value which causes internal server error HOT 2
- Troubleshooting taxonomy field in flexible content HOT 1
- Deprecated function "WPGraphQL\Data\DataSource::resolve_post_object" HOT 1
- Option page ACF fields are null when using Graphiql in Gatsby HOT 2
- Cannot mutate relationship ACF field on userUpdate HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wp-graphql-acf.