I'm using Drupal Commerce 7.x. I have added some fields to the checkout form in the customer profile. Specifically I've added 'Title' and 'Organization'. I'd like to move some of the fields around because they aren't in the order I'd like, but I can't figure out how to move them.
For example, right now the order is: 1. Country (I def. don't want that first) 2. Full name 3. Address etc.
I want it like this:
- Full Name
- Title (new field)
- Organization (new field)
I tried using a module that does this (just as an example, obviously, since only two fields are listed here). Am I on the right track?
<?php
function CommerceAlter_form_commerce_checkout_form_alter(&$form,
&$form_state, &$form_id) {
$order = array('edit-customer-profile-billing-field-title',
'addressfield-container-inline');
foreach ($order as $key => $value){
if (isset($form[$value])){
$form[$value]['#weight'] = $key;
}
}
}
But it didn't do anything.
Note: I was unsure how to reference the fields. The first one above called 'field-title' is the ID for that field and the second listed for addressfield (which is in the form by default) is by class .addressfield-container-inline).