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?
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.
Default checkout Steps in Spree
Spree allows you to modify checkout process to add or remove steps by using respective helpers.
In your case you should go with remove_checkout_step(to remove checkout step) The remove_checkout_step will remove just one checkout step at a time: