Skip Payment Step from Checkout process 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 &lt;myModule&gt;_commerce_checkout_router($order, $checkout_page) {
  global $user;

  if ($checkout_page['page_id']=='checkout') {
    if (!empty($order-&gt;commerce_order_total['und']['0']['data']['components']['2']) &amp;&amp; ($order-&gt;commerce_order_total['und']['0']['data']['components']['2']['name']=='flat_rate_from_store')) {
      drupal_goto('checkout/' . $order-&gt;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.
The problem is you're redirecting without also updating the order's status. The checkout router determines access to a checkout page by matching the order status to the URL, and it will prevent access to any page the order doesn't appear to have reached yet.

In your case, you should just use the same API function the Payment module uses when it needs to redirect past the off-site payment redirect page because an on-site payment method was used. The function is commerce_payment_redirect_pane_next_page() and you can view the function signature and docs in commerce_payment.module.