Disable shipping information pane for "customer collects" option


On our present (non-Drupal) site we have many local customers who order online and collect orders from our shop or workshop to avoid shipping costs, and we also deliver to more distant customers. In Commerce Flat Rate it's easy enough to create a free shipping option for collections, but the customer still has to enter shipping information in order to complete the checkout process, which is confusing for the user.

So, on the Checkout page, I want to offer the user a choice between collection (from either of two locations) or delivery, using radio buttons for example. If the user chooses one of the collection options, I want to hide or disable the "Shipping information" pane and the Shipping checkout page.

I've created simple modules for Drupal sites before, but I don't know how to go about doing this. Any ideas?



Posted: Feb 18, 2012


switch on June 15, 2012

I'm also working on this currently. Not by product but rather giving the customer the option of picking up the order or having it delivered.

My idea is to create a module (open to community of course) that will have a radio button field as the top pane on the checkout page with the "Pickup" or "Delivery" options. This would default to Pickup and would have the Shipping information disabled and hidden at the start.

I have two issues currently:

  1. I can't get the pane to be hidden initially. Shouldn't this work?
    • function pickup_or_delivery_commerce_checkout_pane_info_alter(&$checkout_panes) {
      $checkout_panes['customer_profile_shipping']['enabled'] = 0;
    • I got the pane name from here http://drupal.org/node/1285902 but it seems like scoff had to loop through all of the $checkout_panes. Is that necessary?
  2. The next step is to also have the pane on the shipping page (i believe it's called 'commerce_shipping') disabled.
    • I initially was asking around IRC why commerce_checkout_page_info didn't have an 'enabled' property but I was told by Saisai that if there is no pane on a page that page will be skipped…not sure if that means if the pane is disabled or removed. Guess we'll see.

Any one else run into any of this? or care to share any findings?