spree/spree · warning

Spree::Order#collect_frontend_payment_methods is deprecated

Error message

Spree::Order#collect_frontend_payment_methods is deprecated and will be removed in Spree 6.1. Use #payment_methods instead.

What it means

collect_frontend_payment_methods comes from the shared Spree::Purchase::PaymentProcessing concern; Spree 6.0 renamed it to payment_methods, which is also where payment-method rules are enforced. The shell warns and returns the same list; it is removed in 6.1.

Source

Thrown at spree/core/app/models/spree/order.rb:142

    validates :status, inclusion: { in: STATUSES }

    scope :drafts,         -> { where(status: 'draft') }
    scope :placed_orders,  -> { where(status: 'placed') }
    scope :canceled_orders, -> { where(status: 'canceled') }

    acts_as_taggable_on :tags
    acts_as_taggable_tenant :store_id

    def tags=(tags)
      self.tag_list = tags
    end

    ASSOCIATED_CUSTOMER_ATTRIBUTES = [:customer_id, :email, :bill_address_id, :ship_address_id]

    # @deprecated Use {Spree::Purchase::PaymentProcessing#payment_methods};
    #   removed in 6.1.
    def collect_frontend_payment_methods
      Spree::Deprecation.warn('Spree::Order#collect_frontend_payment_methods is deprecated and will be removed in Spree 6.1. Use #payment_methods instead.')
      payment_methods
    end

    include Spree::DeprecatedCustomerAlias

    belongs_to :customer, class_name: "::#{Spree.customer_class}", optional: true, autosave: true
    # The cart this order was completed from (unique — the completion
    # idempotency key). Backoffice draft orders have no cart.
    belongs_to :cart, class_name: 'Spree::Cart', optional: true, inverse_of: :order
    # The checkout this order was placed in, when it was placed alongside
    # others — one per seller on a marketplace. A single-seller or first-party
    # only checkout produces a bare order and no group.
    belongs_to :order_group, class_name: 'Spree::OrderGroup', optional: true, inverse_of: :orders
    # Whose sale this is. Nil on the operator's own goods, including the
    # first-party child of a mixed marketplace checkout.
    belongs_to :seller, class_name: 'Spree::Seller', optional: true
    belongs_to :created_by, class_name: "::#{Spree.admin_user_class}", optional: true
    belongs_to :approver, class_name: "::#{Spree.admin_user_class}", optional: true

View on GitHub (pinned to 06bf66a868)

Solutions

  1. Replace order.collect_frontend_payment_methods with order.payment_methods.
  2. Do not pass a store argument — the replacement reads store context; set Spree::Current.store when calling outside a request.
  3. Grep checkout code: rg "collect_frontend_payment_methods" app lib and clear every hit.
  4. Verify payment-method rules (channel/market/total) still apply — they gate through the new method.

Example fix

# before
order.collect_frontend_payment_methods

# after
order.payment_methods
Defensive patterns

Strategy: validation

Validate before calling

# Find checkout call sites
# rg "collect_frontend_payment_methods" app lib --type ruby

Type guard

# Works across Spree 5.x and 6.x
order.respond_to?(:payment_methods) ? order.payment_methods : order.collect_frontend_payment_methods

Prevention

When it happens

Trigger: Storefront checkout code listing payment methods via order.collect_frontend_payment_methods — typical in ported checkout controllers, payment-step serializers, and one-page-checkout extensions.

Common situations: Custom storefront checkouts after a 6.0 upgrade; extensions that render the payment method picker and were written against the 5.x method name.

Related errors


AI-assisted analysis of spree/spree@06bf66a868 (2026-08-21). Data as JSON: /api/errors/2dc8d3cf1dd99bec. Report an issue: GitHub.