How to set Billing Address in the checkout page in Drupal commerce?

I am using Commerce node checkout for a particular node which has an address field.

I wish to reuse this address field in the node as the billing address in the Commerce checkout page.


Please use this Drupal 8 module. I think it will full fill your requirement.



There is a function you can use to set the default value for a billing address. hook_addressfield_default_values_alter

<?php function mymodule_addressfield_default_values_alter(&$default_values, $context) { if($context['instance']['field_name'] == 'commerce_customer_address') { global $user; // load the address field from wherever it lives // In my case it was an address field attached to the user $account = user_load($user->uid); $address = $account->field_real_address['und'][0]; foreach($address as $key => $value) { $default_values[$key] = $value; } } } ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.