Closed Steppio closed 1 year ago
Due to time constraints I've had to think of a workaround this using Algolia
Any help in the future in regard to this would be greatly appreciated as it costs alot of extra money to use the Algolia method
Hello, this version of WPGraphQL for ACF has many known conflicts with WPGraphQL for WooCommerce.
We believe many of those conflicts have been resolved in the new version of WPGraphQL for ACF being worked on over here: https://github.com/wp-graphql/wpgraphql-acf.
The new version is what we'll be supporting going forward and this repo will be archived in the not-too-distant future.
If you find the same issue exists in the new version, please open a new issue on that repo with steps to reproduce.
From what I can tell, this IS supported in the new version.
Following your steps to reproduce, I was able to query the data:
Attached is the Field Group export that I used:
acf-export-2023-07-07 (2).json.zip
And the plugin versions I'm running:
Full error message
_Abstract type Collection_Collectionsdata_SingleProduct must resolve to an Object type at runtime for field Collection_Collectionsdata.singleProduct with value \"instance of WPGraphQL\Model\Post\", received \"Product\". Either the Collection_CollectionsdataSingleProduct type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function.
Issue
I am able to create a Post Object / Relationship field (‘Featured Product’ for example) and attach this to a custom taxonomy (‘Collections’ for example).
I can then go into the custom Collections taxonomy and save a Featured Product belonging to this collection.
This works well and pulls through on the Wordpress GraphQL IDE
However the issue occurs when I try to change this Post Object field to accept multiple values (using the ‘Select multiple values’ switch). I make this change, save the changes in ACF and then add an additional product to the Featured Product field, and run the same query again:
If I change the ‘Filter by Post Type’ to Post it works with multiple values, however I cannot seem to attach multiple Products to the post type. It always returns that same error
_Abstract type Collection_Collectionsdata_SingleProduct must resolve to an Object type at runtime for field Collection_Collectionsdata.singleProduct with value \"instance of WPGraphQL\Model\Post\", received \"Product\". Either the Collection_CollectionsdataSingleProduct type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function.
Absolutely any help would be appreciated as this has become quite a big issue now.
Steps to replicate
I’ve created a blank WP instance, installed WooCommerce (v7.6.1) and created two dummy products.
I install the following Gatsby-related / GraphQL plugins:
I install Advanced Custom Fields (v6.1.4) and Custom Post Type UI (v1.13.5)
I create a taxonomy called Collections, attach it to the Product Post type and enable it in GraphQL
I then create a single ACF Post Object field group called ‘Featured Product’ and attach it to the taxonomy and filter by Post Type of ‘Product’:
I then go into my Taxonomy and create a new Collection and add a single Featured Product and save it.
I now change this ACF Post Object to ‘Select multiple values’ and add an additional product to the taxonomy Featured Product:
And this produces the exact same error:
Expected Result
I hoped for WpGraphQL to pull through
Things I’ve tried
I’ve tried changing the PHP version from 8 to 7.4 (this has fixed something else regarding mediaItems query issues for me in the past)
I’ve tried using different versions of the WPGatsby / WpGraphQL / WooGraphQL plugins - it seems to be the same whatever I try
I’ve tried using a Relationship field instead - same issue
I’m at a bit of a loss here so any help would be greatly appreciated!