I'm using spree 2.0.0 in my application. I just want to know how i can edit spree checkout or how I can completely remove / disable any "Step" during Spree checkout process.
Any thoughts on this?
As Documentation says, you can use remove_checkout_step
helper method (which is also much clearer than redefining whole checkout process), for example:
Spree::Order.class_eval do
# ...
remove_checkout_step :delivery
# ...
end
I just found the solution. Here it is.
Step 1:Create app/models/order_decorator.rb file
Step 2: Copy following code in your order_decorator.rb
Spree::Order.class_eval do
checkout_flow do
go_to_state :address
#go_to_state :delivery
go_to_state :payment, if: ->(order) {
order.update_totals
order.payment_required?
}
go_to_state :confirm, if: ->(order) { order.confirmation_required? }
go_to_state :complete, if: ->(order) {
(order.payment_required? && order.has_unprocessed_payments?) || !order.payment_required?
}
remove_transition from: :delivery, to: :confirm
end
end
Example: if you want to remove delivery state just comment it out.You can comment out any step.
You can find more info in the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With