Problem/Motivation
The Token module provides a [commerce_order:url] token. The problem is that this goes to the canonical URL:
case 'url':
if (_token_module($type, 'url') === 'token' && !$entity->isNew() && $entity->hasLinkTemplate('canonical')) {
$replacements[$original] = $entity->toUrl('canonical')->toString();
}
For orders, the canonical URL is the administrative page.
Proposed resolution
We should adjust this so that the url token goes to user view. We should then provide a new admin-url token for linking to the admin page.
Remaining tasks
- Review if we can modify the default
[commerce_order:url] token
- What did 1.x do? Avoid
[commerce_order:url]?
- Do it
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #2
mglamanOkay, this is feasible. Token adds the URL tokens via an alter:
token_token_info_alter
Comment #3
mglamanHere are the patch and test!
The assertion:
Forgot to define @group
This was added when the order was mocked. It's actually not required, anymore.
Comment #4
mglamanFixed the notes in #3.
Comment #6
mglamanLooks like providing this broke the Token integration:
Comment #7
mglamanWe need to keep the
moduleattokenfor Token to keep generating things for us. In fact, we can actually drop defining the type and let Token continue to do that.Comment #8
recidive commentedLooks good to me, though I haven't tested the patch.
Comment #9
mglamanThanks @recidive. I'm going to merge and unblock #3155132: Allow customizing the checkout completion message from the user interface. We've got plenty of time before the next release to adjust any changes for this issue.
Comment #11
mglamanCommitted!