Where did my commerce token go after an update to 7.87

br flag

My Drupal 7 commerce setup sends out a couple of emails after an order is placed. It uses this token:


After updating to Drupal 7.87 (from 7.82), that token started going out as is, not being evaluated.

How do I fix this issue?

it flag
Not sure what you were seeing before, but from my testing, you should most likely be using commerce-customer-address with hyphens, not underscores.
Alan Dixon avatar
br flag
Thanks and yes, that seems to have half-fixed it (although both variants show up in the token list). Now I'm seeing that it's successfully filled in when a custom chooses shipping, but not if they don't. Which kind of makes sense, although kind of not, since the shipping address is getting collected in both cases. I am also confused whether and how this is related to the recent Drupal update. TBH, all I really need is a token that shows the customer's shipping address, and I suspect there's a better way to do it (this is an inherited site, I don't have a lot of commerce experience).
it flag
Yeah, I'm not really sure what might have changed in core there either. It took me trial and error just to get to that point of the token replacing at all. Not sure about finding the individual properties of an address unfortunately.
br flag

In case anyone else has something similar, here's my solution and debugging methodology:

  1. I made a copy of my site and edited the rules governing the checkout to send me all the emails (I could have used mailhog, but this was easier).

  2. I used the 'simulate checkout completion' link at the top of a sample order after editing it to use my email address. A++ to whoever invented that feature!

  3. I used trial and error to see what happens with different tokens that seemed most likely.

The counter-intuitive solution was:


Note that none of the combinations that used hyphens instead of underscores worked.

Also note that the hyphen vs underscore issue isn't universal - some of the hyphen ones work and some don't.

And I have no clue why or how this was related to a Drupal update - it seems like that was the only thing that triggered the change.


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.