Skip to content

Error when querying products that are ACF relationship field items within a Flexible Content #449

@boxxroom

Description

@boxxroom

Describe the bug
Attaching a product relationship within a Flexible content ACF field on to a Page post type renders an Abstract type error due to the resolve. The resolve is expected to resolve to an Object type.

To Reproduce
Steps to reproduce the behavior:

  1. ACF JSON Export File OR
    Create a new ACF Field Group (named WPGraphQL Example) with a Location > Rules equal to Page
    Add a Flexible Content (named Flexible Content)
    Field Type: Relationship (Layout name: Relationship Field, Field Label: Product Relationship)
    Filter by Post Type: Product
    Filter by Taxonomy: Simple (optional)
    Filters: All Checked
    Elements: Featured Image Checked
    Return Object: Post Object
    Save.

  2. Navigate to Pages
    Choose a page: Home (take note of page ID)
    Add ACF Flexible Content
    Relationship Field
    Select 1+ products
    Save

  3. Navigate to GraphiQL IDE > Add GraphQL statement (GraphQL Statement) OR

query PageById($id: Int!) {
  pageBy(pageId: $id) {
    id
    isFrontPage
    wpgraphqlExample {
      flexibleContent {
        ... on Page_Wpgraphqlexample_FlexibleContent_RelationshipField {
          fieldGroupName
          productRelationship {
            ... on SimpleProduct {
              id
              name
            }
          }
        }
      }
    }
  }
}

// Query Variables

{"id": 33}
  1. Press Play > See error

Expected behavior
A list of product objects

Screenshots
WPGraphQL-Example-Error

Desktop (please complete the following information):

  • OS: macOS Big Sur 11.2.1
  • Browser Chrome
  • Version 88.0.4324.182 (Official Build) (x86_64)

Plugin Versions

  • WooGraphQL Version: 0.6.1
  • WPGraphQL Version: 1.2.5
  • WordPress Version: 5.6.2 (Bedrock)
  • WooCommerce Version: 4.8.0
  • WPGraphQL for Advanced Custom Fields: 0.3.5
  • WPGraphQL JWT Authentication: 0.4.1
  • Disable Gutenberg: 2.4
  • Safe SVG: 1.9.9
  • WooCommerce Accommodation Bookings: 1.1.23
  • WooCommerce Bookings: 1.15.31
  • WooCommerce Product Vendors: 2.1.45

Additional context
I have also added to this thread with a information, findings and debug #253 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions