how do you add this functionality to the drupal commerce products? Since "products" are not in the "content" category.

Comments

sushichris created an issue. See original summary.

freelylw’s picture

same question here ? OR the answer is addtoany is not support the commerce product ??

micropat’s picture

Title: How do I add the addtoany fields to my Commerce products » How do I add the addtoany field to my Commerce products
Status: Active » Fixed

Use hook_addtoany_entity_types_alter() to add the commerce_product entity type.

/**
 * Alter the entity types that the AddToAny pseudo-field is available for.
 *
 * @param array $types
 *   The entity types.
 */
function hook_addtoany_entity_types_alter(&$types) {
  // Add the "commerce_product" entity type.
  $types[] = 'commerce_product';
}

Then the AddToAny field will be available in:
Administration > Commerce > Configuration > Product types > Manage display

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

calbasi’s picture

Hi,

I've done a sandbox module to do it: https://www.drupal.org/sandbox/calbasi/3041534
and it's not working

Could you test or examine it? I've just pasted your code...

calbasi’s picture

In fact, I wonder if this hook is running, because I can see addtoany pseudofield on my terms, and I think I should because this hook is used at:

https://cgit.drupalcode.org/addtoany/tree/addtoany.api.php

rovo’s picture

#3 worked for me.