mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Skip shipment creation for payment step
https://github.com/openfoodfoundation/openfoodnetwork/issues/2007
Spree 2.0.4 creates in-memory shipments for the payment step. That means
we don't need to create a shipment in that transition. This change
copies the checkout_flow from the Spree code, but leaves one last
customisation: removal of the confirm step.
75ec77dc31
This commit is contained in:
@@ -30,20 +30,14 @@ Spree::Order.class_eval do
|
||||
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
|
||||
go_to_state :payment, if: ->(order) {
|
||||
order.update_totals
|
||||
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
|
||||
remove_transition from: :delivery, to: :confirm
|
||||
end
|
||||
|
||||
# -- Scopes
|
||||
|
||||
Reference in New Issue
Block a user