I'm trying to set a user's profile fields into the checkout process. A user must change these data only in own profile. The uc_addresses module is unsuitable for my needs. In the order form I need to hide these fields.

Right now I'm using uc_cart_checkout_form_alter to do this:

function my_module_form_uc_cart_checkout_form_alter(&$form, $form_state, $form_id) {
        // load user data
        global $user;

        $user_fields =user_load($user->uid);

        $first_name   = $user_fields->field_name['und']['0']['value'];

        // add data to order form
        $form['panes']['delivery']['delivery_first_name'][LANGUAGE_NONE][0]['value']['#default_value'] = $first_name;

But default value isn't there. Where did I go wrong? How can I fill out an order form (Delivery & Billing information) programmatically in Ubercart?

1 Answer 1


The billing/delivery address panes are driven by a custom uc_address form field. You need to alter it's #default_value object to alter the fields.

For example:

$form['panes']['delivery']['address']['#default_value']->delivery_first_name = $user_fields->field_name['und']['0']['value'];
$form['panes']['billing']['address']['#default_value']->billing_first_name = $user_fields->field_name['und']['0']['value'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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