I'm using Drupal 7 with Commerce (7.1) Commerce Address Book 7.x-2.0

I'm simply trying to change the #empty_option value of the "Addresses on file" select boxes that appear on the checkout page from "-- Choose --" to "Add new address" I'm using hook form alter and then:

if ($form['#id'] == 'commerce-checkout-form-checkout'){
    $form['customer_profile_shipping']['addressbook']['#empty_option'] = (t -'- Add a new billing address -');

But when the page loads, it still shows "--Choose --"

I'm pretty sure this should be easy !


The problem is that your t() function looks like this:

(t -'- Add a new billing address -');

And it is supposed to look like this:

t('- Add a new billing address -');
  • No, the IF statement works just fine. – wotney Mar 27 '18 at 9:03
  • I have updated my answer, I also assume that you have cleared the cache – Jdrupal Mar 27 '18 at 9:39
  • That didn't make a difference either. I appreciate you trying to help though ! – wotney Mar 27 '18 at 11:19
  • Though it might not help it might be a syntax error. Now the only thing that can be wrong is the array definition. – Jdrupal Mar 27 '18 at 11:37
  • Maybe you need to add [LANGUAGE_NONE][0] at the end of the array. – Jdrupal Mar 27 '18 at 11:38

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.