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.
In the commerce_cardonfile settings at admin/commerce/config/cardonfile are currently not respected by this module. The UI of COF has a setting called "Card on file storage method" with these three options:
- Show a checkbox letting customers opt-in to storing their card on file.
- Show a checkbox letting customers opt-out of storing their card on file.
- Do not show a checkbox and always store their card on file.
But no matter what you choose, the user has not opportunity to opt out of COF.
Comment | File | Size | Author |
---|---|---|---|
#4 | cof_integration_does-2490258-4.patch | 1.24 KB | Lukas von Blarer |
#2 | commerce_braintree-cardonfile-fix.patch | 1.18 KB | swelljoe |
Comments
Comment #1
nyleve101 CreditAttribution: nyleve101 as a volunteer commentedHas anyone else experienced this issue and resolved it for the Drop-in UI? I'm using Commerce recurring so the card always has to be saved.
Any help or feedback is greatly appreciated.
Comment #2
swelljoe CreditAttribution: swelljoe as a volunteer commentedI had the same problem. I think the attached patch will fix it (I'm still wrapping my head around the way this works, and I'm not even sure how to test it yet). I think, if I'm understanding how things work, and how the formapi works, this patch changes it to make the cardonfile_save method call always happen if you've configured it to "required", and it does not display the checkbox. And, I think the checkbox still functions correctly. Again, I'm not sure how to test this yet, since I have some other stuff not working right in my shopping cart, which prevents testing. At least, I know it removes the checkbox when set to "required", I don't know if it actually saves card data correctly.
Comment #3
swelljoe CreditAttribution: swelljoe as a volunteer commentedAs an update, I think the patch I submitted works as intended. I've since made a bunch of other changes to accommodate $0 payments and to fix a bug in name storage so I'm not sure if I made any other changes to make the card on file storage method option work, but it's working on my local install.
I dunno the process for getting such a thing committed.
Comment #4
Lukas von BlarerYou should file separate issues for each bug and upload a patch for each. As far as I can tell you already created them.
Regarding your patch: There are coding standards issues. For example this line:
if (!empty($payment_method['settings']['cardonfile']) && !empty($user->uid)) { if ($storage !== 'required') {
This doesn't meet coding standards. I attached a patch that fixes this.
Comment #5
andyg5000