Skip to main content
Log inSign up

Introducing PRODUCT_CATEGORY_ID in CollectionRuleColumn and Deprecating PRODUCT_TAXONOMY_NODE_ID for automated collection creation

As of API version 2024-10, we're adding the new PRODUCT_CATEGORY_ID as a column for the CollectionRuleColumn which is used to create automated collections. This field maps directly to the newly added Product Category as defined in the updated standard product taxonomy and will allow for the creation of smart collections based on this new category tree.

What's new?

  • Introduction of PRODUCT_CATEGORY_ID Column: We are introducing a new column, PRODUCT_CATEGORY_ID, in the CollectionRuleColumn. This column will directly map to the category ID of a product, allowing for more precise and efficient collection rule creation based on product categories as defined in the updated standard product taxonomy.

What's deprecated?

  • Deprecation of PRODUCT_TAXONOMY_NODE_ID Column: The PRODUCT_TAXONOMY_NODE_ID column is being deprecated. This column previously used the now-deprecated productCategory field on products, the previous method for categorising products before the updated standard product taxonomy was introduced this year. Developers should transition to using the new PRODUCT_CATEGORY_ID column to ensure newly created products that necessarily use the updated product taxonomy are included in automated collections as expected.

Developer action required

Developers are encouraged to update their implementations to use the new PRODUCT_CATEGORY_ID column when specifying product attributes for populating smart collections. The deprecated PRODUCT_TAXONOMY_NODE_ID will remain functional but is scheduled for removal in a future API version. Transitioning early will ensure smoother operations and access to the enhanced functionality provided by the new schema.

Example of updated usage

To create a smart collection using the new PRODUCT_CATEGORY_ID, modify the collection creation mutation as follows:

mutation CollectionCreate($input: CollectionInput!) {
  collectionCreate(input: $input) {
    userErrors {
      field
      message
    }
    collection {
      id
      title
      descriptionHtml
      handle
      sortOrder
      ruleSet {
        appliedDisjunctively
        rules {
          column
          relation
          condition
        }
      }
    }
  }
}
{
  "input": {
    "title": "Our entire shoe collection",
    "descriptionHtml": "View <b>every</b> shoe available in our store.",
    "ruleSet": {
      "appliedDisjunctively": false,
      "rules": {
        "column": "PRODUCT_CATEGORY_ID",
        "relation": "EQUALS",
        "condition": "gid://shopify/TaxonomyCategory/aa-5" 
      }
    }
  }
}

Learn more about collection creation at Shopify.dev

Was this section helpful?