New filter: allow non-core post types in Relationship ACF field
The current logic assumes that all post models are instances of the Post model. Unfortunately, when non-core post types such as WooCommerce are part of this request, the result is an internal error (see screenshot).
This filter would make it possible for extensions to properly set the correct source Type, thereby fulfilling the request. A similar filter already exists (graphql_acf_post_object_source) for the post_object field type; this new filter tries to follow the same pattern.
An example implementation would be identical to graphql_acf_post_object_source. See https://github.com/wp-graphql/wp-graphql-woocommerce/blob/develop/includes/class-acf-schema-filters.php#L56
Screenshots
Error when no filter is in place 👇🏽

Relationship field filtering only Product post type 👇🏽

👋🏽 hey @jasonbahl - have you had a chance to look at this PR? Happy to discuss. Thanks!
@jacobarriola I think this field is going to be changing to become a formal one-to-one connection, now that WPGraphQL core has formal support for them.
And with that, this will now use the Post Object Loader, which has filters more centrally. So instead of having to filter every specific field in the Graph that might return something like a WooCommerce product, WooCommerce could filter the loader / model layer more centrally and work with the rest of the Graph.
I'm going to leave this PR open, for now, to keep it fresh as we work on updating things like making relationship-type fields proper connections, etc, and provide documentation for how to overcome some of these scenarios this filter is intended to address.
Ok, great @jasonbahl. I'm currently working off of a forked repo, so I'd like to get back on the main project as soon as possible. Thanks! 🙏
Is there anything I can do to help?
Hi @jasonbahl 👋🏽
Just a friendly nudge to move this to the top of your inbox. Not sure how progress is coming along with the Post Object Loader and how it impacts this PR.
Thanks!
Friendly reminder @jasonbahl ! This is helping me as well! Would be nice to work not off a forked repo 😄