wp-graphql-acf icon indicating copy to clipboard operation
wp-graphql-acf copied to clipboard

Querying products tagged to ACF relationship or post object fields returning Abstract type must resolve to an Object type at runtime error

Open brianpereradap opened this issue 3 years ago • 2 comments

Getting internal server error when trying to query woocommerce products which are tagged to an ACF relationship or post object field.

Abstract type Support_manual_SupportSectionOptions_AssignedToProduct must resolve to an Object type at runtime for field Support_manual_SupportSectionOptions.assignedToProduct with value "instance of WPGraphQL\Model\Post", received "Product". Either the Support_manual_SupportSectionOptions_AssignedToProduct type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.

image

We have been struggling to find a workaround, but still we are unable to move forward.

Environment details: wp-graphql-acf : v0.5.3 wp-graphql: v1.6.12 wp-graphql-woocommerce: v0.10.7 Wordpress: v5.9

Any assistance to get ahead of this issue is greatly appreciated.

brianpereradap avatar Feb 22 '22 11:02 brianpereradap

Hi ! I have the same problem when a relationship field references multiple post types. My workaround was to use a relationship field per post type for the moment.

JohannLesacher avatar Mar 10 '22 11:03 JohannLesacher

Hi ! I have the same problem when a relationship field references multiple post types. My workaround was to use a relationship field per post type for the moment.

I face this issue when I was specifically trying to tag woocommerce products using the relationship field. In your case are you using the woocommerce products?

brianpereradap avatar Mar 11 '22 08:03 brianpereradap

Any solution yet? I also have same problem when using relationship with Woocommerce products

oat-tigerheart avatar Jan 04 '23 10:01 oat-tigerheart

I have this problem when a post set as related is then moved to trash

alevals avatar Mar 09 '23 10:03 alevals

There are several bugs between WPGraphQL for ACF and WPGraphQL for WooCommerce. Some have been resolved by recent releases of WPGraphQL for WooCommerce, but some remain.

We're working on a new version (complete rewrite) of WPGraphQL for ACF over here: https://github.com/wp-graphql/wpgraphql-acf

It resolves a LOT of bugs related to ACF + WooCommerce and I'd recommend migrating to that version sooner than later as it will be the version we release to WordPress.org in the not-too-distant future.

Also related: https://github.com/wp-graphql/wp-graphql-acf/issues/356#issuecomment-1626288679

jasonbahl avatar Jul 12 '23 04:07 jasonbahl