title: How to customize Spree checkout process?
body: <p>My environment.</p>
  
  <pre><code>Mac OSX 10.7.4
  Ruby 1.9.3p0
  Rails 3.2.3
  Spree 1.1.0
  </code></pre>
  
  <p>Hello, I am Japanese programmer and newbie to Spree. I would like to customize Spree's checkout process to remove checkout steps such as selecting delivery method and payment method.</p>
  
  <p>According to the <a href="https://guides.spreecommerce.com/developer/checkout.html" rel="nofollow">Spree Guides</a>, I need to define an entirely new state machine for <code>Order</code> model.</p>
  
  <p>So, I added <code>order_decorator.rb</code> to <code>app/models</code> directory as shown in the following.</p>
  
  <pre><code># app/models/order_decorator.rb
  
  module SpreeCustomExtension
    class Engine &lt; Rails::Engine
      def self.activate
        Order.class_eval do
          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; 'confirm'
              transition :from =&gt; 'confirm', :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 Spree::GatewayError
                if Spree::Config[:allow_checkout_on_gateway_error]
                  true
                else
                  false
                end
              end
            end
  
            after_transition :to =&gt; 'complete', :do =&gt; :finalize!
            after_transition :to =&gt; 'confirm', :do =&gt; :create_tax_charge!
            after_transition :to =&gt; 'payment', :do =&gt; :create_shipment!
            after_transition :to =&gt; 'canceled', :do =&gt; :after_cancel
  
          end
        end
      end
    end
  end
  </code></pre>
  
  <p>Also, I added <code>spree_site.rb</code> file to my <code>lib/</code> directory.</p>
  
  <pre><code># lib/spree_site.rb
  
  module SpreeSite
    class Engine &lt; Rails::Engine
      def self.activate
        Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
          Rails.configuration.cache_classes ? require(c) : load(c)
        end
      end
  
      def load_tasks
      end
  
      config.to_prepare &amp;method(:activate).to_proc
    end
  end
  </code></pre>
  
  <p>But, It seems that there is no change at all. Anyone know where I should modify to customize checkout process?</p>
  
  <p>please suggest some good spree tutorial or advice. I really appreciate any advices.</p>
  
  <p>Thank you in advance.</p>