wp-graphql / wp-graphql-acf

WPGraphQL for Advanced Custom Fields
https://wpgraphql.com/acf
627 stars 123 forks source link

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

Closed brianpereradap closed 1 year ago

brianpereradap commented 2 years ago

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.

JohannLesacher commented 2 years ago

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.

brianpereradap commented 2 years ago

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?

oat-tigerheart commented 1 year ago

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

alevals commented 1 year ago

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

jasonbahl commented 1 year ago

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