Discussions

Add a Delivery address

Hi I would like to add a seperate Delivery address to the checkout process, could someone point me in the correct direction with this please. Ultimatly I would like a check box below Billing address which says Use same address for delivery, then on untick would open up a new form section which contains new address fields.

cheers

Posted: Aug 31, 2011

Comments

courtney.mob on September 1, 2011

Hi,

I'm not sure how to add the functionality of "use same address for delivery," but from my experience, I can tell you how to add shipping address fields on checkout.

Solution #1) Go to store > Customer Profiles > Profile Types > Billing Information > Manage Fields

Here you can add another postal address field using the Dynamic address form widget and call it Delivery Address.

Solution #2) Another solution, the one I used, is to install the Commerce Shipping Module, which adds a Shipping Information Customer Profile, which is seperate from the Billing Information Customer Profile. I hope maybe I've helped you some. I'm new to Drupal. Good luck.

purplemonkey on September 2, 2011

thanks for the reply, I have had a look at the profile type, certainly offers the kind of thing I'm looking for. will have a bash at creating some JS tick box for it.... can't seem to download the CSM at the moment, but I probably need it anyway, for shipping...

I've got a nother message running trying to remove the State field from my address, would you know anything about that?

again. cheers. new to drupal myself, and it seems very complex.

purplemonkey on September 2, 2011

nice one courtney.mob, I have now sorted it, I added two extra fields in profile types, one was a boolean radio button selection which handled the Use seperate address question, then I added the following JS to my page.tpl file to hide or show the extra address fields(which are not set to mandatory) based on if the user actions the radio button selection. All seems to work fine. :)

"Script"
jQuery(document).ready(function() {
if (jQuery('#edit-customer-profile-billing-field-delivery-address').length != 0) {

jQuery('#edit-customer-profile-billing-field-delivery-address').hide();
jQuery('#edit-customer-profile-billing-field-sameaddress-und-1').attr('onClick','showform()');
jQuery('#edit-customer-profile-billing-field-sameaddress-und-0').attr('onClick','hideform()');
}
});

function showform() {
jQuery('#edit-customer-profile-billing-field-delivery-address').show('slow');
}
function hideform() {
jQuery('#edit-customer-profile-billing-field-delivery-address').hide('slow');
}

"End Script"

essbee on November 29, 2011

purplemonkey,

Out of interest how did you handle the review form? If you implement this method and the customer happens to put information in the delivery address fields before unchecking "Use separate address" field then this information is shown to the user on the Review page - possibly a confusing UX.

Love to hear how you handled it.

essbee

ñull on December 1, 2011

With that check box set, hiding is not sufficient. The actual Billing address needs to be copied to the Shipping fields. The empty shipping fields can not be the basis for a Shipping quote calculation. Is there already a module for this?