The following error appears in the Status Report after enabling Commerce Order module.

$info['types']['commerce_order-adjustments']
$info['types']['commerce_order_item-adjustments']

2.x-dev also here
when the Тoken module enabled

CommentFileSizeAuthor
#21 2835693-21.patch734 bytesjungle
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

liva created an issue. See original summary.

liva’s picture

Issue summary: View changes
liva’s picture

Issue summary: View changes
bojanz’s picture

Title: Token types do not have any tokens defined » No tokens found for adjustments

Retitling for clarity.
Unsure if we even need adjustment tokens, maybe we just need to make that message go away.

websiteworkspace’s picture

I'm seeing the same problem using the latest dev branch:


TOKEN TYPES DO NOT HAVE ANY TOKENS DEFINED

$info['types']['commerce_order-adjustments']
$info['types']['commerce_order_item-adjustments']


websiteworkspace’s picture

This bug/problem still exists with the latest daily dev branch release of Commerce 2.x, as is visible on the admin/reports/status page.


TOKEN TYPES DO NOT HAVE ANY TOKENS DEFINED

$info['types']['commerce_order-adjustments']
$info['types']['commerce_order_item-adjustments']

0Sarah0Al’s picture

I can see it too, in admin/reports/status page.

devad’s picture

Version: 8.x-2.0-beta4 » 8.x-2.x-dev
.jch’s picture

vendor\drupal\console\bin\drupal site:status ...for D8.5.1 PHP 7.2 and latest Commerce 8.x-2.x-dev build returns...

Token types do not have any tokens defined
$info[types][commerce_order-adjustments]
$info[types][commerce_order_item-adjustments]
$info[types][commerce_shipment-items]

sealionking’s picture

the same status

Anonymous’s picture

Same here:


    $info['types']['commerce_order-adjustments']
    $info['types']['commerce_order_item-adjustments']
    $info['types']['commerce_shipment-items']

wavesailor’s picture

I get the same message

snlnz’s picture

Running:

Drupal 8.7.3
Commerce 2.13
PHP 7.3

Seeing the same status message.

andrimont’s picture

Running:

Drupal 8.8.1
Commerce 2.16
PHP 7.3.11

Seeing the same status message w/ more undefined tokens :

TOKEN TYPES DO NOT HAVE ANY TOKENS DEFINED
$info['types']['commerce_order-adjustments']
$info['types']['commerce_order_item-adjustments']
$info['types']['node-layout_builder__layout']
$info['types']['term-layout_builder__layout']
$info['types']['user-layout_builder__layout']
milovan’s picture

I am getting:

Token types do not have any tokens defined

    $info['types']['commerce_order-adjustments']
    $info['types']['commerce_order_item-adjustments']
    $info['types']['commerce_shipment-adjustments']
    $info['types']['commerce_shipment-items']
briantes’s picture

I get the same. Any solution?

tonytheferg’s picture

Same.

TOKEN TYPES DO NOT HAVE ANY TOKENS DEFINED
 $info['types']['commerce_order-adjustments']
 $info['types']['commerce_order_item-adjustments']
 $info['types']['commerce_shipment-adjustments']
 $info['types']['commerce_shipment-items']
jsacksick’s picture

Priority: Normal » Minor

Besides a message in the status report, is this affecting anything? If not, I consider that a minor issue.

bbuchert’s picture

It is just the status report for me.

tonytheferg’s picture

Just a status report, but leaves the impression something is wrong. Seems like we should either define some tokens or ditch the message if it's not a problem. 😂

jungle’s picture

Status: Active » Needs review
FileSize
734 bytes

With a new hook added into the token module here #3246693: Add a new hook to allow altering processed/sorted token info, it's possible to remove them now, by implementing the new hook.

Attaching a patch to get rid of the token types below.

TOKEN TYPES DO NOT HAVE ANY TOKENS DEFINED
$info['types']['commerce_order-adjustments']
$info['types']['commerce_order_item-adjustments']

As commerce_shipment is not included in the commerce project, the patch will not handle it here. However, the code is similar, you can write your own patch or implement the hook in your custom module.

To me, I just want to let such a message disappear from the status report page because I have not used those tokens.

sah62’s picture

The patch in #21, combined with the patch from #3246693: Add a new hook to allow altering processed/sorted token info, works fine for me. Here's a patch for Commerce Shipping: #3246787: No tokens found for adjustments

jsacksick’s picture

Status: Needs review » Postponed

We can probably be smarter and do that for all adjustment fields. But in any case, there's currently no point in committing this as there's no guarantee the token patch will go in, the approach wasn't even approved by the maintainers.

Berdir’s picture

> With a new hook added into the token module here #3246693: Add a new hook to allow altering processed/sorted token info, it's possible to remove them now, by implementing the new hook.

I don't understand this. The tokens are defined in field_token_info_alter(), you should be able to implement hook_module_implements_alter() and move the commerce_order hook to run after that one. Note that there is an issue to move them to the token module namespace, so I'd check for both field and token module hooks here.

That said, I'm also open to detect and prevent this issue in token.module directly.. We define the token type after a few initial checks, but we can introduce some logic to see if we did manage to define a token for this type and only define it if that's the case. I'd suggest a $field_tokens or similar variable that holds $info['tokens'][$field_token_name], and only if it's non-empty we define the type as well as the list tokens I guess.

fchandler’s picture

I still get these;

$info['types']['commerce_order-adjustments']
$info['types']['commerce_order_item-adjustments']
$info['types']['commerce_shipment-adjustments']
$info['types']['commerce_shipment-items']

even after applying this #2835693-21.patch, and #3246787: No tokens found for adjustments
Version: 8.x-2.29, Drupa 9.3.7, Apache/2.4.41 (Ubuntu), PHP 8.0.16, MySQL 5.7.31

joshuautley’s picture

I tested #21 and #22's suggested 2nd patch. I can confirm #22's suggested other patch worked ONLY after clearing the cache.

Running Drupal Version 9.4.3

RBTC

carlodimartino’s picture

I still get: TOKEN TYPES DO NOT HAVE ANY TOKENS DEFINED
for these;

$info['types']['commerce_order-adjustments']
$info['types']['commerce_order_item-adjustments']

even after applying 2835693-21.patch and flushing all caches.