title: Spree Checkout - Remove Step
body: <p>I am trying to remove 2 checkout steps.
  I have tried to follow the documentation in the site <a href="http://guides.spreecommerce.com/checkout.html" rel="nofollow">http://guides.spreecommerce.com/checkout.html</a> 
  but still nothing happens. </p>
  
  <p>I am using 
  Spree 1.1.2 
  ruby 1.9.2p318 
  Rails 3.2.6 
  Ubuntu 12.04 (precise) 32-bit</p>
  
  <p>I'll tell you what I have done and you will tell me what to fix.
  Should I change the name or location of the file?
  Or should I change other files too?
  How can I debug it?</p>
  
  <p>I have created a new file "app/models/spree/order_decorator.rb" (also tried it under "app/models/order_decorator.rb")</p>
  
  <pre><code>module SpreeCustomExtension
  
    class Engine &lt; Rails::Engine
  
      def self.activate
  
        Spree::Order.class_eval do
  
  
  
          StateMachine::Machine.ignore_method_conflicts = true   # I HAVE ADDED THOSE 2 LINES LATER, HOPING IT WOULD HELP ME,
  
          Spree::Order.state_machines.clear                                # IT DIDN'T.
  
  
  
          # customize the checkout state machine
  
          Order.state_machines[:state] = StateMachine::Machine.new(Order, :initial =&gt; 'cart') do
  
            after_transition :to =&gt; 'complete', :do =&gt; :complete_order
  
            before_transition :to =&gt; 'complete', :do =&gt; :process_payment
  
            event :next do
  
              transition :from =&gt; 'cart', :to =&gt; 'payment'
  
              transition :from =&gt; 'payment', :to =&gt; 'complete'
  
            end
  
  
  
            event :cancel do
  
              transition :to =&gt; 'canceled', :if =&gt; :allow_cancel?
  
            end
  
            event :return do
  
              transition :to =&gt; 'returned', :from =&gt; 'awaiting_return'
  
            end
  
            event :resume do
  
              transition :to =&gt; 'resumed', :from =&gt; 'canceled', :if =&gt; :allow_resume?
  
            end
  
            event :authorize_return do
  
              transition :to =&gt; 'awaiting_return'
  
            end
  
  
  
            before_transition :to =&gt; 'complete' do |order|
  
              begin
  
                order.process_payments!
  
              rescue Core::GatewayError
  
                !!Spree::Config[:allow_checkout_on_gateway_error]
  
              end
  
            end
  
  
  
            before_transition :to =&gt; ['delivery'] do |order|
  
              order.shipments.each { |s| s.destroy unless s.shipping_method.available_to_order?(order) }
  
            end
  
  
  
            after_transition :to =&gt; 'complete', :do =&gt; :finalize!
  
            after_transition :to =&gt; 'delivery', :do =&gt; :create_tax_charge!
  
            after_transition :to =&gt; 'payment',  :do =&gt; :create_shipment!
  
            after_transition :to =&gt; 'resumed',  :do =&gt; :after_resume
  
            after_transition :to =&gt; 'canceled', :do =&gt; :after_cancel 
  
          end
  
  
  
        end
  
      end
  
    end
  
  end
  </code></pre>
  
  <hr>
  
  <p>Then I tried the same file with different code, still nothing happened</p>
  
  <hr>
  
  <pre><code>Spree::Order.class_eval do 
  
  
  
    StateMachine::Machine.ignore_method_conflicts = true 
  
    Spree::Order.state_machines.clear 
  
  
  
    state_machine :initial =&gt; 'cart', :use_transactions =&gt; false do 
  
  
  
      event :next do 
  
        transition :from =&gt; 'cart',     :to =&gt; 'payment', :if =&gt; :payment_required? 
  
        transition :from =&gt; 'cart',     :to =&gt; 'complete' 
  
        transition :from =&gt; 'confirm',  :to =&gt; 'complete' 
  
  
  
        # note: some payment methods will not support a confirm step 
  
        transition :from =&gt; 'payment',  :to =&gt; 'confirm', 
  
                                        :if =&gt; Proc.new { |order| order.payment_method &amp;&amp; order.payment_method.payment_profiles_supported? } 
  
  
  
        transition :from =&gt; 'payment', :to =&gt; 'complete' 
  
      end 
  
  
  
      event :cancel do 
  
        transition :to =&gt; 'canceled', :if =&gt; :allow_cancel? 
  
      end 
  
      event :return do 
  
        transition :to =&gt; 'returned', :from =&gt; 'awaiting_return' 
  
      end 
  
      event :resume do 
  
        transition :to =&gt; 'resumed', :from =&gt; 'canceled', :if =&gt; :allow_resume? 
  
      end 
  
      event :authorize_return do 
  
        transition :to =&gt; 'awaiting_return' 
  
      end 
  
  
  
      before_transition :to =&gt; 'complete' do |order| 
  
        begin 
  
          order.process_payments! 
  
        rescue Core::GatewayError 
  
          if Spree::Config[:allow_checkout_on_gateway_error] 
  
            true 
  
          else 
  
            false 
  
          end 
  
        end 
  
      end 
  
  
  
      before_transition :to =&gt; ['delivery'] do |order| 
  
        order.shipments.each { |s| s.destroy unless s.shipping_method.available_to_order?(order) } 
  
      end 
  
  
  
      after_transition :to =&gt; 'complete', :do =&gt; :finalize! 
  
      after_transition :to =&gt; 'delivery', :do =&gt; :create_tax_charge! 
  
      after_transition :to =&gt; 'payment',  :do =&gt; :create_shipment! 
  
      after_transition :to =&gt; 'resumed',  :do =&gt; :after_resume 
  
      after_transition :to =&gt; 'canceled', :do =&gt; :after_cancel 
  
  
  
    end 
  
  
  
  end 
  </code></pre>
  
  <hr>