{"record":{"id":"ef4708d76a973359","repo":"spree/spree","slug":"spree-metafields-is-deprecated-and-will-be-removed","errorCode":null,"errorMessage":"Spree.metafields is deprecated and will be removed in Spree 6.1. Use Spree.custom_fields instead.","messagePattern":"Spree\\.metafields is deprecated and will be removed in Spree 6\\.1\\. Use Spree\\.custom_fields instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"spree/core/lib/spree/core.rb","lineNumber":535,"sourceCode":"  # @return [Spree::SetupTasks]\n  def self.store_setup_tasks\n    @store_setup_tasks ||= Spree::SetupTasks.new\n  end\n\n  def self.translatable_resources\n    Rails.application.config.spree.translatable_resources\n  end\n\n  def self.translatable_resources=(value)\n    Rails.application.config.spree.translatable_resources = value\n  end\n\n  def self.custom_fields\n    Rails.application.config.spree.custom_fields\n  end\n\n  def self.metafields\n    Spree::Deprecation.warn('Spree.metafields is deprecated and will be removed in Spree 6.1. Use Spree.custom_fields instead.') if defined?(Spree::Deprecation)\n    custom_fields\n  end\n\n  def self.integrations\n    Rails.application.config.spree.integrations\n  end\n\n  def self.integrations=(value)\n    Rails.application.config.spree.integrations = value\n  end\n\n  # Registry mapping a numbered resource to the generator that produces its\n  # document numbers. With no entry, the store's `document_number_format`\n  # preference picks between the sequential and random strategies.\n  #\n  # @return [Spree::NumberGenerators::Registry]\n  # @example Custom order numbers\n  #   Spree.number_generators[:order] = 'MyApp::BranchOrderNumbers'","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/spree/spree/blob/06bf66a8684b9de03210bbb2ddc8c1f5ba522fa2/spree/core/lib/spree/core.rb#L517-L553","documentation":"Spree 6.0 renamed Metafields to Custom Fields, and the registry accessor Spree.metafields (which reads Rails.application.config.spree.custom_fields) became Spree.custom_fields. The old reader survives for one release: it warns, then returns the same registry. Removed in Spree 6.1, after which calls raise NoMethodError.","triggerScenarios":"Calling Spree.metafields to register or enumerate custom field definitions - typically in extension initializers (Spree.metafields << MyDefinition) or host-app config that adds resource types to the registry.","commonSituations":"Extensions written against the 5.x metafields vocabulary (docs/plans/5.4-6.0-custom-fields-rename.md); host apps registering custom field definitions; code enumerating registrable resources for admin UIs.","solutions":["Use Spree.custom_fields for reads and registration","Sweep: grep -rn 'Spree.metafields' config lib app","Upgrade extensions that register definitions through the old accessor","Run the suite with deprecations raised so stale registry access fails loudly"],"exampleFix":"# before\nSpree.metafields << MyExtension::FieldDefinition\n\n# after\nSpree.custom_fields << MyExtension::FieldDefinition","handlingStrategy":"validation","validationCode":"grep -rn 'Spree\\.metafields' config lib app && echo 'PORT NEEDED' || echo 'clean'","typeGuard":"Spree.respond_to?(:custom_fields)  # true on Spree 6","tryCatchPattern":null,"preventionTips":["Register custom-field definitions through Spree.custom_fields in extension initializers","Feature-detect in gems supporting both 5.x and 6.0: Spree.respond_to?(:custom_fields) ? Spree.custom_fields : Spree.metafields","Raise deprecations in test"],"tags":["deprecation","rename","metafields","custom-fields","spree-6-1"],"backgroundTag":"deprecated-api-usage","analyzedSha":"06bf66a8684b9de03210bbb2ddc8c1f5ba522fa2","analyzedAt":"2026-08-21T14:59:48.125Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}