spree/spree · warning
Spree::Promotion::Rules::Taxon is deprecated and will be rem
Error message
Spree::Promotion::Rules::Taxon is deprecated and will be removed in Spree 6.1. Use Spree::Promotion::Rules::Category instead.
What it means
In Spree 6.0 the taxon-based promotion rule was renamed to Spree::Promotion::Rules::Category. The file promotion/rules/taxon.rb now contains only a true constant alias (`Taxon = Category`) plus a Spree::Deprecation.warn that fires when the file loads — not when a method is called. Old STI type strings ('Spree::Promotion::Rules::Taxon') still instantiate correctly through the alias until the 6.0 data migration rewrites them; the alias is removed in 6.1.
Source
Thrown at spree/core/app/models/spree/promotion/rules/taxon.rb:13
# frozen_string_literal: true
module Spree
class Promotion
module Rules
# Deprecation alias for Spree::Promotion::Rules::Category, renamed from
# Spree::Promotion::Rules::Taxon in 6.0. A true constant alias, so old STI type
# strings (`'Spree::Promotion::Rules::Taxon'`) still instantiate correctly until
# the Phase 4 migration rewrites them. The warning fires when this file loads.
# Removed in 6.1.
Taxon = Category
Spree::Deprecation.warn('Spree::Promotion::Rules::Taxon is deprecated and will be removed in Spree 6.1. Use Spree::Promotion::Rules::Category instead.')
end
end
end
View on GitHub (pinned to 06bf66a868)
Solutions
- Replace every code reference to `Spree::Promotion::Rules::Taxon` with `Spree::Promotion::Rules::Category` (grep the app, initializers, factories, specs, and `class_name:` options).
- Run the 6.0 taxon→category data migration so promotion rule STI `type` values are rewritten to the Category class string — after that no old-type row loads the alias.
- Update extensions/decorators that reference or subclass the old constant to their 6.0-compatible releases.
- If the warning appears only at boot from eager loading and no references remain, silence it temporarily with `Spree::Deprecation.silence { Spree::Promotion::Rules::Taxon }`-style wrapping or accept the log noise until 6.1 — but verify the DB has no legacy type strings first.
Example fix
# before rule = Spree::Promotion::Rules::Taxon.new # after rule = Spree::Promotion::Rules::Category.new
Defensive patterns
Strategy: validation
Validate before calling
# Check for legacy STI type strings that instantiate the alias: Spree::PromotionRule.where(type: 'Spree::Promotion::Rules::Taxon').exists? # Check for code references (run in shell): # grep -rn "Promotion::Rules::Taxon" app/ lib/ config/ spec/ --exclude-dir=tmp # Fail on load-time deprecations in CI: Spree::Deprecation.behavior = :raise
Prevention
- After a rename-heavy Spree upgrade, grep for the old constant everywhere including class_name: options and factories.
- Run the shipped data migrations immediately on upgrade so legacy STI type strings stop instantiating deprecated aliases.
- Remember eager loading fires file-load warnings at boot with zero references — don't burn time hunting phantom callers before checking eager_load.
When it happens
Trigger: Anything that causes app/models/spree/promotion/rules/taxon.rb to load: referencing `Spree::Promotion::Rules::Taxon` in code, `type: 'Spree::Promotion::Rules::Taxon'` rows being instantiated (promotion rules table STI), factories/seeds using the old class, or production eager-loading every file under app/models at boot. In development it fires on first reference; with `config.eager_load = true` it fires at boot even with no explicit reference.
Common situations: Upgrading to Spree 6.0 with promotion_rule rows whose STI `type` still says 'Spree::Promotion::Rules::Taxon' (data migration not yet run), extensions/decorators referencing the old constant, or old specs/factories. Also appears as boot-time noise in production logs purely from eager load.
Related errors
- Spree::Promotion::Rules::Category#taxon_ids_string= is depre
- Spree::PromotionRuleCategory#taxon is deprecated and will be
- Spree::PromotionRuleCategory#taxon= is deprecated and will b
- Spree::PromotionRuleTaxon is deprecated and will be removed
- Spree::Order#use_all_coupon_codes is deprecated and will be
AI-assisted analysis of spree/spree@06bf66a868 (2026-08-21).
Data as JSON: /api/errors/ccf784eff1b67e99.
Report an issue: GitHub.