spree/spree · warning
Spree::Order#disassociate_user! is deprecated and will be re
Error message
Spree::Order#disassociate_user! is deprecated and will be removed in Spree 6.1. Use #disassociate_customer! instead.
What it means
Part of the User-to-Customer rename: Spree::Order#disassociate_user! warns and forwards to disassociate_customer!, which nulls ASSOCIATED_CUSTOMER_ATTRIBUTES (customer_id, email, bill_address_id, ship_address_id) in a single update!. The shell is removed in 6.1.
Source
Thrown at spree/core/app/models/spree/order.rb:529
def associate_customer!(customer, override_email = true)
Spree.cart_associate_service.call(guest_cart: self, customer: customer, override_email: override_email)
end
# @deprecated Use {#associate_customer!}; removed in 6.1.
def associate_user!(user, override_email = true)
Spree::Deprecation.warn('Spree::Order#associate_user! is deprecated and will be removed in Spree 6.1. Use #associate_customer! instead.')
associate_customer!(user, override_email)
end
def disassociate_customer!
nullified_attributes = ASSOCIATED_CUSTOMER_ATTRIBUTES.index_with(nil)
update!(nullified_attributes)
end
# @deprecated Use {#disassociate_customer!}; removed in 6.1.
def disassociate_user!
Spree::Deprecation.warn('Spree::Order#disassociate_user! is deprecated and will be removed in Spree 6.1. Use #disassociate_customer! instead.')
disassociate_customer!
end
def quantity_of(variant, options = {})
line_item = find_line_item_by_variant(variant, options)
line_item ? line_item.quantity : 0
end
def find_line_item_by_variant(variant, options = {})
line_items.detect do |line_item|
line_item.variant_id == variant.id &&
Spree.cart_compare_line_items_service.new.call(order: self, line_item: line_item, options: options).value
end
end
# Re-estimates tax through the configured provider (writes TaxLine rows
# with replace-all semantics).
def create_tax_charge!View on GitHub (pinned to 06bf66a868)
Solutions
- Replace order.disassociate_user! with order.disassociate_customer!.
- Use Spree.customer_class (never Spree::User directly) in the surrounding code, per platform-auth conventions.
- For full GDPR workflows, prefer the dedicated export/anonymization surface rather than hand-rolled attribute nulling.
- Grep tasks and jobs: rg "disassociate_user" app lib.
Example fix
# before order.disassociate_user! # after order.disassociate_customer!
Defensive patterns
Strategy: validation
Validate before calling
# One-off audit of anonymization tasks # rg "disassociate_user" app lib --type ruby
Type guard
# Works across Spree 5.x and 6.x if order.respond_to?(:disassociate_customer!) order.disassociate_customer! else order.disassociate_user! end
Prevention
- Use Spree.customer_class instead of Spree::User in surrounding code so the rename stays mechanical.
- Cover anonymization tasks with their own specs — they run rarely and miss deprecation noise in CI.
- Prefer dedicated GDPR export/anonymization tooling over hand-rolled attribute nulling.
When it happens
Trigger: GDPR/anonymization rake tasks and guest-checkout cleanup code calling order.disassociate_user! — the pre-6.0 method name for detaching the buyer record from an order.
Common situations: Post-upgrade data-protection tooling; extensions that detach users from orders after export; store credit / PII scrubbers written against 5.x naming.
Related errors
- Spree::Order#special_instructions is deprecated and will be
- Spree::Order#special_instructions= is deprecated and will be
- Spree::Order#collect_frontend_payment_methods is deprecated
- Spree::Order#shipping_discount is deprecated and will be rem
- `Order#available_payment_methods` is deprecated and will be
AI-assisted analysis of spree/spree@06bf66a868 (2026-08-21).
Data as JSON: /api/errors/7b16330861710143.
Report an issue: GitHub.