Vote up!
Vote down!

Commerce Shipping bug: "Full name" modifies [user:name] token


I found out that when I enter a "Full name" in the commerce shipping and billing address information, the [user:name] value will be changed to the "Full name" entered.

As you can see the user name in the first picture is different from the value of the [user:name] token.


However, when I enter a different "Full name" for subsequent orders, or change the username it doesn't modify the value of the [user:name] token.

Is there a way to stop the commerce shipping and billing to modify the [user:name] token or to change the value of the token manually?

Thank you for your help,


Asked by: ashash
on March 1, 2014

3 Answers

Vote up!
Vote down!

This is happening in the commerce_kickstart_user module that comes with Kickstart 2. It's using the hook_username_alter() hook.



To undo what it's doing, you could create your own hook:

 * Implements hook_username_alter().
function CUSTOMMODULE_username_alter(&$name, $account) {
$name = $account->name;
Josh Miller
Answer by: Josh Miller
Posted: Mar 7, 2014
Vote up!
Vote down!

Thanks! I realised that I didn't need that hook at all. All I needed to do was to comment out

function commerce_kickstart_user_username_alter(&$name, $account) {
  if (module_exists('commerce_addressbook')) {
    $billing_profile_id = commerce_addressbook_get_default_profile_id($account->uid, 'billing');
    if ($billing_profile_id) {
      $billing_profile = commerce_customer_profile_load($billing_profile_id);
      $name = $billing_profile->commerce_customer_address[LANGUAGE_NONE][0]['name_line'];

and everything was back to the way I wanted it to be!

Answer by: ashash
Posted: Mar 8, 2014