Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There is a rule "Assign an anonymous order to a pre-existing user", but not "Assign an anonymous invoice to a pre-existing user". So result is that when anonymous customer makes an order, generated invoice is saved for user/0 aka anonymous, not to user account which e-mail was used to make this order. So Commerce Invoice needs rule like "Assign an anonymous order to a pre-existing user".
I tried to make it myself, but can't make it work.
I need it for my custom invoice view.
Comment | File | Size | Author |
---|---|---|---|
invoice_uid.jpg | 138.49 KB | UrmasZ |
Comments
Comment #1
NecroHill CreditAttribution: NecroHill commentedI am facing exactly the same issue on beta and dev version, no issues with registered users though. any ideas how to resolve it?
Comment #2
NecroHill CreditAttribution: NecroHill commentedthis module does not assign an invoice to a pre-existing user on my configuration as I set the "Update the order status on checkout completion" rule to set orders status to completed instead of pending (for non-shippable products) - it works ok when you change orders status from pending to completed manually
Comment #3
C-LogemannWhen you are using a workflow where invoices should be generated before assigning existing users to order then you need a solution.
But I think this is a feature request.
Comment #4
sportel CreditAttribution: sportel commentedI agree, this should be a feature request. I'm generating invoices when the order status is set to pending, so that a customer gets an invoice before he made a payment and the order status is set to complete. That works fine, until an existing customer makes a new order without logging in first.
I believe my workflow is quite common.
Mike.
Comment #5
sportel CreditAttribution: sportel commentedI've solved this issue (I think) with a simple Rules Component:
This Rules Component creates an invoice for a given Commerce Order. Now you can add this Rules Component with a new action to every rule that creates an order (e.g.: Assign an anonymous order to a pre-existing user, Create a new account for an anonymous order).
Make sure it's the last action of that rule.
Perhaps it's wise to add a condition to the standard rule (for creating an invoice) to make sure an invoice is never created with UID = 0. A rules link could be added to the Orders View to create an invoice manually for when this happens?
Please let me know what you think.
Mike.
Comment #6
C-LogemannWhen the rule works fine it can be included as default rule by code. But there should be some testing and reviewing before.
Because it's a rule it can be tested by copy and paste. So I ignore that there isn't currently a patch provided. But if somebody wants to get this faster into code (s)he should provide additionally a patch.
Comment #7
sportel CreditAttribution: sportel commentedIt works for me, but I'd like some confirmation.
Comment #8
steveoriolHello Sportel,
I comfirme to you, Your Rules works for me too on an production site.
Big Merci.
Comment #9
sportel CreditAttribution: sportel commented@steveoriol,
Thanks for confirming. It's up to the maintainer of this module now to decide if the rule should be included.
Mike.
Comment #10
dwkitchen CreditAttribution: dwkitchen commentedClosing all Drupal 7 issues as this project will only be supported for Drupal 8