I have setup a Drupal Commerce website (using Drupal 7) with two shipping options:
- Delivery by courier company
- Pickup from store
The next step in checkout process is to choose the payment method. BUT... if the second choice (pickup from store) is chosen, the only available payment method is Pay at store (offline payment). I have managed to show only this option through Rules. So far so good.
My concern is that for better user experience I have to make this step skipped. So after the Shipping step where the user selects the Pickup from store option, the next logical step is the Review pane for a final review by the user before complete the checkout process.
I have read that the Payment selection method (checkout step) is required for the Payment Redirection (I fail to understand it).
I have already tried to use hook_commerce_checkout_router, checking the $order shipping line and use the drupal_goto function redirect to the review page. My custom function is the following:
function <myModule>_commerce_checkout_router($order, $checkout_page) {
global $user;
if ($checkout_page['page_id']=='checkout') {
if (!empty($order->commerce_order_total['und']['0']['data']['components']['2']) && ($order->commerce_order_total['und']['0']['data']['components']['2']['name']=='flat_rate_from_store')) {
drupal_goto('checkout/' . $order->order_id . '/' . $checkout_page['next_page']);
}
}
}
I get error "The page isn’t redirecting properly". It is the same result as if someone is at the shipping step and manually tried to enter at the url the /review.
Do you think is possible to achieve skipping this step to speed up the checkout process or I have to give up trying ? At year 2017 it is very important to give a user the best and the most logical way to move around in a website. Useless steps and clicks slow down the process and maybe end in frustration.