GraphQL: How to access CollectionRule fields column and relation

jsndong
New Member
1 0 0

Hello. I'm trying to query for all three fields of the CollectionRule type, but column and relation are always null while condition returns the correct value. Am I defining my types or enums wrongs? I used the Shopify docs as a guide for these definitions.

 

 

 

  enum CollectionRuleColumn {
    VENDOR
    TAG
    TITLE
    TYPE
    VARIANT_COMPARE_AT_PRICE
    VARIANT_INVENTORY
    VARIANT_PRICE
    VARIANT_TITLE
    VARIANT_WEIGHT
    IS_PRICE_REDUCED
  }

  enum CollectionRuleRelation {
    STARTS_WITH
    ENDS_WITH
    EQUALS
    GREATER_THAN
    IS_NOT_SET
    IS_SET
    LESS_THAN
    NOT_CONTAINS
    NOT_EQUALS
    CONTAINS
  }

  type CollectionRule {
    column: CollectionRuleColumn
    condition: String!
    relation: CollectionRuleRelation
  }

  type CollectionRuleSet {
    appliedDisjunctively: Boolean!
    rules: [CollectionRule!]!
  }

  type Collection {
    id: ID!
    title: String
    description: String
    handle: String
    image: Image
    products: ProductConnection
    metafields: MetafieldConnection
    categories: CollectionConnection
    published: Boolean
    ruleSet: CollectionRuleSet
  }

 

 

and my query looks like this

 

 

{ 
  collections {
    edges {
      node {
        handle
        ruleSet {
          rules {
            column
            condition
            relation
          }
        }
      }
   }
}

 

0 Likes