Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2007 Skip shipment creation for payment step #2431

Merged
merged 2 commits into from
Jul 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions app/models/spree/order_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,10 @@
before_save :update_shipping_fees!, if: :complete?
before_save :update_payment_fees!, if: :complete?

checkout_flow do
go_to_state :address
go_to_state :delivery
go_to_state :payment, :if => lambda { |order|
# Fix for #2191
if order.shipping_method.andand.delivery?
if order.ship_address.andand.valid?
order.create_shipment!
order.update_totals
end
end
order.payment_required?
}
# NOTE: :confirm step was removed because we were not actually using it
# go_to_state :confirm, :if => lambda { |order| order.confirmation_required? }
go_to_state :complete
remove_transition :from => :delivery, :to => :confirm
end
# Orders are confirmed with their payment, we don't use the confirm step.
# Here we remove that step from Spree's checkout state machine.
# See: https://guides.spreecommerce.org/developer/checkout.html#modifying-the-checkout-flow
remove_checkout_step :confirm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is soooo much better now!


# -- Scopes
scope :managed_by, lambda { |user|
Expand Down