Adding a new token to a product I'm trying to add a token to Product using the below code. The problem is that, although this adds the token I'm after, it also removes a number of standard tokens that are needed (e.g., the title).

/**
 * Implements hook_token_info().
 */
function fw_product_token_info() {

  $type = [
    'name' =&gt; 'Product',
    'description' =&gt; t('Useful additional tokens for products'),
    'needs-data' =&gt; 'commerce_product',
  ];

  $tokens['fw_product_parent_url'] = [
      'name' =&gt; t('Parent URL'),
      'description' =&gt; t('The full path to this product\'s parent'),
  ];

  return [
    'types' =&gt; ['commerce_product' =&gt; $type],
    'tokens' =&gt; ['commerce_product' =&gt; $tokens],
  ];

}

/**
 * Implements hook_tokens().
 */
function fw_product_tokens($type, $tokens, array $data = [], array $options = [], BubbleableMetadata $bubbleable_metadata) {

  $replacements = [];

  if ($type == 'commerce_product' &amp;&amp; !empty($data['commerce_product'])) {
    foreach ($tokens as $name =&gt; $original) {
      switch ($name) {
        case 'fw_product_parent_url':
          $entity = $data['commerce_product'];
          if ($parent_entity = \Drupal::service('fw_product.parent')-&gt;getEntity($entity)) {
            $replacements[$original] = $parent_entity-&gt;url('canonical');
          }
          else {
            $replacements[$original] = '';
          }
          break;
      }
    }
  }
  return $replacements;
}
Return 'tokens' if you want to add new/custom to the existing list.

return [
  'tokens' =&gt; ['commerce_product' =&gt; $tokens],
];