I know that this is related to Rules, but since Commerce relies heavily on Rules for customization and it specifically has to do with the Commerce License as an entity, I'm posting this support request here.
With Drupal 7 using Rules 7.27, I've installed and set up Drupal Commerce with no real problems.
The rule ‘Create a new account for an anonymous order’ works well but I need to add a condition that only executes the action of creating a new account only if the product being ordered is a Commerce License. Commerce License is an entity so I tried both of the following conditions, but they prevent the Rules actions from triggering:
Entity is of type: Parameter: Entity: [site:current-cart-order], Entity type: Commerce License
Entity is of type: Parameter: Entity: [commerce-order], Entity type: Commerce License
I have looked everywhere and can't tell if this functionality is possible. It would seem though that I'd be able to tell rules to distinguish between Commerce License orders and other orders.
Comments
Comment #1
kebz commentedSomeone can correct me if I'm wrong.... but would that be a "permission" function?
Basically, give the anonymous user the ability to order/purchase a member/subscription plan to create an account.
That's what I'm working on as well.
Comment #2
chadhester commentedI know this is an old issue, but perhaps this information will help someone in the future. (Hi future person! Do we all have jet packs?)
I'm not sure the exact token that you want to use to check for the "Commerce License" entity type, but the one's that you're listing would return "Commerce Order" as the entity type, meaning it would fail.
You will need to find a way to load the part of the order that contains the relationship to the "Commerce License" entity, which I suspect would be a Line Item in the Commerce Order entity. You'll probably need to loop through the line items to look for an entry, similar to the comment here: http://drupal.stackexchange.com/questions/109022/creating-a-loop-conditi...
Comment #3
tomtech commentedAutomatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.