0

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

[commerce-order:commerce-customer-shipping:commerce_customer_address]

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?

3
  • Not sure what you were seeing before, but from my testing, you should most likely be using commerce-customer-address with hyphens, not underscores. Jan 27 at 17:37
  • 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).
    – Alan Dixon
    Jan 28 at 20:28
  • 1
    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. 😬 Jan 29 at 21:03

1 Answer 1

0

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:

[commerce_order:commerce_customer_shipping]

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.

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.