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.
Make the billing information optional through checkout pane configuration.
Comment | File | Size | Author |
---|---|---|---|
#35 | collect_billing_information.png | 47.27 KB | bojanz |
#33 | interdiff_28-33.txt | 17.95 KB | bojanz |
#33 | 2905028-33-optional-billing-information.patch | 22.87 KB | bojanz |
| |||
#28 | interdiff_27-28.txt | 1.05 KB | jsacksick |
#28 | 2905028-28-optional-billing-information.patch | 17.86 KB | jsacksick |
|
Comments
Comment #2
czigor CreditAttribution: czigor at Centarro commentedComment #3
czigor CreditAttribution: czigor at Centarro commentedComment #4
czigor CreditAttribution: czigor at Centarro commentedComment #5
edaa CreditAttribution: edaa commentedThanks, works well.
Comment #6
edaa CreditAttribution: edaa commentedShow 'Payment information' pane summary on 'Review' step when 'needs_billing' option is disabled.
Comment #7
edaa CreditAttribution: edaa commentedAdd schema for needs_billing.
Comment #8
czigor CreditAttribution: czigor at Centarro commentedJust a missing docblock.
Comment #9
mitrpaka CreditAttribution: mitrpaka as a volunteer commentedThank you for the patch!
If store has only one payment gateway defined, Payment information is shown as empty fieldset once when 'Collect billing information' option is disabled. Any possibility to check and hide fieldset entirely if only one payment gateway defined?
Comment #10
bojanz CreditAttribution: bojanz at Centarro commentedI don't want to keep the patch in RTBC cause it might make someone believe it's safe to use. This is very experimental and will crash any gateway expecting a billing profile.
Comment #11
gologan CreditAttribution: gologan commentedDoes this work with the Commerce Braintree gateway?
We use that for credit cards and PayPal and don't need any address info.
Edit: This doesn't appear to work with the Commerce Braintree payment gateway.
Comment #12
SAVEL CreditAttribution: SAVEL as a volunteer commentedHere is the patch based on #8 and compatible with latest dev and Commerce 8.x-2.5 Release.
Comment #13
Honza Pobořil CreditAttribution: Honza Pobořil as a volunteer commentedPatch #12 works for me.
Anybody have an idea how to offer user to fill billing info if he wants?
Comment #14
Dubs CreditAttribution: Dubs as a volunteer and at Drupology commentedI might be missing something obvious in configuration, but it doesn't seem like you can make the billing information optional on the order entity? So I have empty billing info which prevents a save without that data if you edit an order. Like I say, perhaps there's some config I've missed somewhere?
Comment #15
SAVEL CreditAttribution: SAVEL as a volunteer commentedHere is the patch compatible with latest dev and Commerce 8.x-2.10 Release.
Comment #16
SAVEL CreditAttribution: SAVEL as a volunteer commentedDubs, you are right!
We still have a problem with editing order in administration interface. We should also remove billing information form from there.
I've never faced the problem as I never tried to edit order via web-interface.
Comment #17
mike82 CreditAttribution: mike82 commentedInstead of making the billing information optional through checkout pane configuration it could be more usefull to Keep billing information as a separate pane instead of replacing it with the payment information pane.
Comment #18
Dubs CreditAttribution: Dubs as a volunteer and at Drupology commented@mike82 - that sounds like a good idea. A lot of sites would not require billing information at all.
Comment #19
bobemoe CreditAttribution: bobemoe commentedJust updated drupal/commerce (2.11.0 => 2.12.0) and the patch no longer applies.
Comment #20
piggito CreditAttribution: piggito as a volunteer and at Skilld commentedRebased patch on #15
Comment #22
bojanz CreditAttribution: bojanz at Centarro commentedTime to revisit this.
We need to make this a payment gateway annotation + setting. Existing gateways might crash without a billing profile, so they need to opt-in.
Comment #23
bojanz CreditAttribution: bojanz at Centarro commentedHere's a rough sketch made after discussing with jsacksick.
Needs an update hook for making the billing_profile field optional.
Needs a functional test somewhere (PaymentCheckoutTest, I guess).
Comment #24
jsacksick CreditAttribution: jsacksick at Centarro for PayPal, Inc commentedComment #25
jsacksick CreditAttribution: jsacksick at Centarro for PayPal, Inc commentedComment #26
jsacksick CreditAttribution: jsacksick at Centarro for PayPal, Inc commentedComment #27
jsacksick CreditAttribution: jsacksick at Centarro for PayPal, Inc commentedComment #28
jsacksick CreditAttribution: jsacksick at Centarro for PayPal, Inc commentedComment #29
Honza Pobořil CreditAttribution: Honza Pobořil as a volunteer commentedI want to have it optional for user. Could I add it to patch?
Checkbox Collect billing information change to radios:
Collect billing information
Comment #30
bojanz CreditAttribution: bojanz at Centarro commented@Bobík
No, that would need to stay custom to your site.
Comment #31
Honza Pobořil CreditAttribution: Honza Pobořil as a volunteer commentedIn buildPaneForm at PaymentInformation.php:
So it seems there is edge case for free orders - even with current patch it will not be able to disable biling profile form.
Comment #32
bojanz CreditAttribution: bojanz at Centarro commentedYes, this only covers non-free orders currently.
Free orders have a separate code path, and settings for it are being explored in #2871483: Add checkout settings for payment method behavior. Not sure we should touch it here.
Comment #33
bojanz CreditAttribution: bojanz at Centarro commentedHere are some cleanups.
Simplified the payment gateway setting logic.
Added a warning description after brainstorming with Ryan.
Fixed the following problems:
1) The payment gateway label should be shown in the Review page even if there's no billing information. The test should confirm.
2) PaymentMethodEditForm should create the billing profile if missing, cause it's possible that the merchant enabled billing info collection after it was previously disabled.
3) testManualWithoutBilling should confirm that the payment instructions are still shown, cause that confirms a payment was created as well.
Opened #3050301: Clean up the payment method plugin forms for related cleanups, to avoid bloating this patch.
Opened #3050303: Forward port the 1.x button to explicitly add a profile on the order edit form for the admin UI problem mentioned in #14 / #16.
Comment #35
bojanz CreditAttribution: bojanz at Centarro commentedAdded explanation docblocks to the Onsite and OffsiteRedirect example gateways.
Tweaked the docblocks for OrderInterface::getBillingProfile and PaymentMethodInterface::getBillingProfile.
Committed! Change record created. Screenshot attached.
Since the setting is per-gateway, you can easily duplicate your gateway and have two versions, one that collects billing information and one that doesn't. You can then use conditions to restrict each one to specific order types, stores, customer roles, etc. That would give you per-order-type, per-store, per-customer-group settings as well!
Note that only the Manual gateway shows this checkbox right now. Each gateway will need to be updated by adding the requires_billing_information = FALSE annotation key, and updating code to check for a NULL billing profile.
Braintree issue: #3050427: Allow not collecting billing information.
Stripe issue: #3050428: Allow not collecting billing information.
Comment #36
bojanz CreditAttribution: bojanz at Centarro commentedAlso note that #9 (the empty fieldset) was fixed in #3049355: Checkout panes are rendered even if they are empty.
Comment #38
init90Awesome work, thanks! Just encountered with such case.