mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-03 22:06:07 +00:00
Merge pull request #2431 from mkllnk/2007-no-shipment-for-payment
2007 Skip shipment creation for payment step
This commit is contained in:
@@ -27,24 +27,10 @@ Spree::Order.class_eval do
|
||||
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
|
||||
|
||||
# -- Scopes
|
||||
scope :managed_by, lambda { |user|
|
||||
|
||||
Reference in New Issue
Block a user