Removing the "address" page on all-intangible checkouts (EC3 for Drupal5)

Events happening in the community are now at Drupal community events on www.drupal.org.
Dewi Morgan's picture

I asked in IRC how to prevent all-intangible carts from asking for an address.

I was told it was impossible.

This was a problem. Well over 50% of our business is all-intangible products. Looking at the log of page requests, people entering the checkout were very clearly dropping out at the address page. A lot of them were dropping out. Clearly users hated it. This was no good.

So, here's how to hack it. It's not pretty. "Pretty" would involve a checkbox in the settings that let the admin toggle prompting for the address, and saving the state of it as a drupal variable and blah blah. Too much hassle for me. But I promised them in IRC that I'd post my hack, so here you go.

In modules/ecommerce/address/address.module address_checkoutapi() in the 'form' section around line 75 replace:

drupal_set_title(t('Choose a billing address'));

with:

        // Kludge to remove this page for all-intangible goods. - Dewi.
        // drupal_set_title(t('Choose a billing address'));
        return false;

and in the 'review' section around line 111 replace:

      }
      else {
        $form['title'] = array( '#value' => t('Billing address') );
      }
      $form['billing_address'] = array( '#value' =>  store_format_address($txn,'billing','html') );

with:

      // Kludge to fix no-address if non-shippable. - Dewi.
      //}
      //else {
      //  $form['title'] = array( '#value' => t('Billing address') );
      //}
      //$form['billing_address'] = array( '#value' =>  store_format_address($txn,'billing','html') );
        $form['billing_address'] = array( '#value' =>  store_format_address($txn,'billing','html') );
      } // End Kludge.

This nasty evil hack is placed on the public domain so you may do as you will with it. No warranty is made: don't come to me if it eats your kids. But it worked for me.

Comments

Just want to point out that

rszrama's picture

Just want to point out that this was addressed in Ubercart and should be easily addressable in EC3. Because this is a common need, I added in a hook for actions performed on items in the cart with a function called uc_cart_is_shippable() that will invoke this hook for each product in the cart to see if they're all shippable. The default is, of course, for a product to be shippable, but modules like the file product module contributed by CpILL use this hook to designate these downloadables as not shippable. When the checkout page is constructed, if uc_cart_is_shippable() returns FALSE, it doesn't display the shipping/delivery forms.

I know the EC workflow for checkout is a little different, but I imagine something very similar could be done here. You could even do something simple like have it based of the node type w/ a simple admin interface to pick which node types are shippable and which ones aren't. I didn't think it would really matter, but even this early in the game there's a record label (Ozore Age) using Ubercart to sell music and a few other folks w/ these types of site in the works.

e-Commerce Module

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: