So I thought I had been pretty clever when in the code for a custom checkout pane, in a custom checkout page, I did this:
function checkout_pane_giftaid_pane_checkout_form($form, &$form_state, $checkout_pane, $order) {
if($showPane==1){
//show something awesome
}
else {
$checkout_pages = commerce_checkout_pages();
commerce_order_status_update($order,'checkout_payment');
$url = 'checkout/'. $order->order_number . '/' . $checkout_pages['gift-aid']['next_page'];
drupal_goto($url);
}
}
If showPane is equal to 1 it displays the Pane's content, if not it directs you to the next checkout page. This however has presented an issue because I have two custom checkout pages.
The result of this is if you are on 'custom page 2' and press 'Go Back' it goes back to the previous page ('custom page 1'), but if $showPane=0 on this page then the else statement means its set to forward. So a user hits 'go back' on 'custom page 2' and what they see, is this page reload (actually it has gone back to 'custom page 1' where it is told to go to the next page, 'custom page 2').
So my question is this: clearly I have not gone about 'skipping' custom checkout pages in the right way, how would I do it properly?
admin/commerce/config/checkout
? If I remember rightly a page that doesn't contain panes won't be shown in the checkout process