Closed iamkeir closed 1 year ago
@iamkeir This is not bug. The creating of user triggers after saving the paymentSource when checking out as guest. I'll mark it as enhancement.
@pdaleramirez thanks, but, if the creation of the user AFTER check out is the issue, how is it that all the other customer information is saved?
Either way, probably worth updating the docs to say savePaymentSource
only works if customer logged in?
Got to the bottom of this - paymentSource
is saved against User rather than Customer, which seems a little odd as all other data is against Customer. And, yes, it seems you currently require currentUser
to use savePaymentSource
. Referencing: https://github.com/craftcms/commerce/blob/9311f824ed24e303dfec46ab01b9b90823237410/src/controllers/PaymentsController.php#L252
So, yes, that enhancement would be very useful!
Created a Stack Exchange query for finding a workaround in the meantime: https://craftcms.stackexchange.com/questions/39598/commerce-3-register-user-and-save-payment-source-after-order-complete-for-gues
@lukeholder completed as in now supported, or completed as in not bug/won't fix? No worries either way.
What happened?
Description
During guest checkout, when adding a new payment source and presenting customer with checkboxes for both
registerUserOnOrderComplete
andsavePaymentSource
, the payment source is not saved.Possibly intended behaviour? If so, some insight into why might be useful - other customer information is saved (e.g. addresses) so it seems odd to exclude the payment source. Was not able to find anything in the docs that indicates
savePaymentSource
only works if user logged in during checkout.Steps to reproduce
registerUserOnOrderComplete
savePaymentSource
Craft CMS version
Craft Pro 3.7.43
Craft Commerce version
3.4.15
PHP version
8.0.8
Operating system and version
Darwin 21.1.0
Database type and version
MySQL 5.7.34
Image driver and version
No response
Installed plugins and versions
No response