Another in my growing list of things which are broken when going through order -> payment flow using the Admin UI.
A user's default billing address, although it appears to be attached to the Order is not.
Flow:
- add items to cart
- go to the edit for for that Order and it does appear that there is a default billing address set (assuming user has a default billing address)
- go to add payment and select a new CC (only recently allowed via a patch) or select from an existing CC. For existing CC it does not show the billing address (even if one does get attached, see below). For adding a new CC it, like the order edit form) does show the default billing address (payment method is set to collect billing info).
- add payment
- payment goes through even though no billing info (possibly a bug in Auth.net payment module??)
- manually place the order (another bug in admin flow)
go back and review order and still no billing address set for the order. also, the receipt email has not billing address info (which makes sense as one is not yet attached to the Order).
if, after initial cart is created, i go to edit the order and simply save it; this attaches the billing address to the order and things now works as expected.
although there are other bugs related to this for the std cart checkout flow, the user's default billing address does get attached to the order at some point along the way to checkout.
As mentioned, this adds to my growing list of bugs in the Admins making payment flow, that i am wondering if there is simply a bigger issue here. Possibly something that has even been broken in a recent release of Commerce? There seem to be many things missing from the Admin flow that do work (more or less) with the std cart checkout:
- payment methods can't be selected (partially fixed by recent patch); but even with this patch, only methods accessible to non-admins can be used
- order isn't placed when payment is complete (i have written code to suplant this)
- fees (sandbox commerce_fee module) aren't added
- billing address isn't attached to order (this issue)
Or possibly there is some "preprocess" call that the developer is required to make in external call to "prepare" the order for processing? Anyone know what that might be?
Or, is it really just left up to the site-builder to add custom code for all of these to make admin process complete properly?
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 3128719-9.patch | 3.58 KB | jsacksick |
| #9 | 3128719-9-tests-only.patch | 1.43 KB | jsacksick |
Comments
Comment #2
liquidcms commentedalthough i am sure this is a bug; i thought i would try to write some code to get around the issue. figured i could start by at least assigning the user's default billing address to the order when it is saved:
Not quite sure why i need to set the value to $profile rather than $profile->id() (as with other term ref fields i have set; but i think a function of the widget used (which seems like a bug in Drupal core)).. but full entity does work.. sort of... Sure enough the Order does now have the user's Billing Address attached; but, for some reason which is making my head hurt.. it also removes the profile from the user's Address Book.. WTH??
Even if this were to work correctly; i don't think this would be the full answer to the bug here as changing or adding a new address for a new card at payment time is still not attached to the order.. so likely need to do some smarter code there to attach the value being set. Would love to know if this is a bug and i should be looking to fix in Commerce code or if it is expected to be coded in a custom module (which makes no sense).
Comment #3
jsacksick commentedComment #4
liquidcms commentedoutdated meaning it is fixed in a new release? which release?
Comment #5
jsacksick commentedComment #6
jsacksick commentedComment #7
jsacksick commentedThis issue is a bit hard to parse TBH, it's mixing several different unrelated issues together, which makes me wonder if it doesn't make sense to start with a fresh report, to handle the different issues one by one...
My patch is transferring the billing profile from the payment method to the order, just like what's happening during checkout. We need to expand tests to confirm that and ensure this won't broke in the future.
Comment #8
jsacksick commentedComment #9
jsacksick commentedRetitling for clarity, added tests coverage, submitting both a failing test + a patch that has the test and the fix.
Comment #10
jsacksick commented@liquidcms: Are you able to confirm the fix?
Comment #13
jsacksick commentedComment #14
liquidcms commentedYes, my client is still interested in this. I hope to get to it in the next couple of days.
Thanks for providing a fix.
Comment #15
liquidcms commentedWorks great. Thank you kindly. :)
Comment #18
jsacksick commentedCommitted, thanks for helping with testing!