mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Remove confirm checkout step and it's additional removal
This commit is contained in:
@@ -21,16 +21,10 @@ module Spree
|
||||
order.update_totals
|
||||
order.payment_required?
|
||||
}
|
||||
go_to_state :confirm, if: ->(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
|
||||
|
||||
state_machine.after_transition to: :payment, do: :charge_shipping_and_payment_fees!
|
||||
|
||||
state_machine.event :restart_checkout do
|
||||
@@ -248,11 +242,6 @@ module Spree
|
||||
total.to_f > 0.0 && !skip_payment_for_subscription?
|
||||
end
|
||||
|
||||
# If true, causes the confirmation step to happen during the checkout process
|
||||
def confirmation_required?
|
||||
payments.map(&:payment_method).compact.any?(&:payment_profiles_supported?)
|
||||
end
|
||||
|
||||
# Indicates the number of items in the order
|
||||
def item_count
|
||||
line_items.inject(0) { |sum, li| sum + li.quantity }
|
||||
|
||||
Reference in New Issue
Block a user