Check step params and redirect if step is inconsistent to order state

This commit is contained in:
Jean-Baptiste Bellet
2022-08-09 10:32:57 +02:00
committed by Maikel Linke
parent a6e3f43344
commit 77eec6e6f3
3 changed files with 38 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ class SplitCheckoutController < ::BaseController
def edit
redirect_to_step_based_on_order unless params[:step]
check_step if params[:step]
end
def update
@@ -145,4 +146,13 @@ class SplitCheckoutController < ::BaseController
end
redirect_to_step_based_on_order
end
def check_step
case @order.state
when "cart", "address", "delivery"
redirect_to checkout_step_path(:details) unless params[:step] == "details"
when "payment"
redirect_to checkout_step_path(:payment) if params[:step] == "summary"
end
end
end