Right now if payments are configured, checkout will always require a payment.
We should be able to configure (per order type) how to handle free orders (total = 0):
* Do not collect any information (nothing)
* Collect billing information (still need to capture CRM related items)
* Collect billing and payment information (free trial subscription order use case)
| Comment | File | Size | Author |
|---|---|---|---|
| #41 | 2856583-41-free-orders.patch | 11.82 KB | bojanz |
| #2 | free_orders-2856583-2.patch | 817 bytes | chishah92 |
| #4 | allow_free_order--2856583-4.patch | 1.6 KB | dom. |
| #14 | allow_free_orders-2856583-14.patch | 3.87 KB | chrisrockwell |
| #17 | allow_free_orders-2856583-17.patch | 7.09 KB | nikathone |
Comments
Comment #2
chishah92 commentedThis Patch is temporary fix i feel, as it is not configurable, but just playing with the payment information pane according to order total. But , this patch will resolve the issue.
Comment #3
dom. commentedHi !
This seems a must have since coupons are now in Commerce 2.x and you may happen to have a coupon leading to a free backet (usage of gift card for instance).
The issue I see trying your patch is the following: it completely skips the PaymentInformation pane, thus you also skip the billing information panel. It seems thought that you would still ask for people information, while not actually sending them thought the payment process. The patch should be thus a little more clever to let you fill billing information while not requiring you to choose a payment method and not sending you to payment gateway.
Ohh god: my english is so bad on this one, I hope someone can understand what I mean !
Comment #4
dom. commentedFollowing #3 I would rather suggest this patch for review.
Comment #5
grimreaperHello,
I have tested both patchs, but it does not solved my problem.
To avoid a fatal error from Paypal when sending a free order. I created a manual paiement method for free order and only allow Paypal method when the order is not free.
The problem I have is that after entering a coupon, the list of paiement methods is not refreshed. It is only refreshed if (refreshing the page and) I select a paiement method and so get a form error for selecting an unavailable method.
I currently not have time to investigate.
Comment #6
sumanthkumarc commentedi tried in the way of #4 as follows and it looks to work fine.
This satisifies below:
a) Collect just the billing information - we do have payment information pane to collect details.
b) Collect a payment method, but don't charge it - we collect it and not sending it to gateway, but need to check what happens for onsite gateway, currently i only tried on offsite gateways.
Comment #7
sagesolutions commentedI tried #4, but it doesn't quite solve my problem.
I'm using stripe as my payment gateway.
If I apply a coupon which results in a $0.00 order, it should hide / remove the credit fields. The user shouldn't be required to enter in credit info on a free order. However, I would like to collect the user's information.
I'm on the latest dev branches of both stripe and commerce.
Comment #8
megachrizClosed #2912306: Missing billing information pane as a duplicate. In there the suggestion is that Commerce Payment should not remove the billing information pane:
Comment #9
sorabh.v6Comment #10
sorabh.v6I can confirm that the patch in #4 is working correctly for me. After applying the patch I tried with authorize.net payment gateway. It did not created any payment against the order. Just saved the payment information.
Thanks All
Comment #11
sagesolutions commentedI agree that #4 does allow free orders, however it would be better if the payment gateway was hidden when the order gets set (or reduced to) zero.
Should we open a new ticket hiding payment gateway info when order total is zero, or keep it in this one?
Comment #12
sorabh.v6I agree with @sagesolutions. It would be good if payment gateway is hidden on free orders.
Comment #13
mglamanI had discussed this with Bojan. We need a checkout pane setting which says:
For free orders:
* Do not collect any information (nothing)
* Collect billing information (still need to capture CRM related items)
* Collect billing and payment information (free trial subscription order use case)
Comment #14
chrisrockwell commentedPer @mglaman's comment this should be Needs work, I think.
I'm attaching a WIP that adds settings to the PaymentInformation pane. Right now it only works if admin opts to collect none, what I know still needs to be done:
- conditionally hide credit card information only
- Decide if changing the step button label is appropriate
- Tests
- How to deal with #3 in Matt's comment: Collect billing and payment information. I'm unsure how to deal with that and I _think_ it reaches farther than this panes. i.e. If a payment method is configured to authorize and capture, do we need to override those for authorize only? In the case of authorize.net, I know we can't auth & capture a $0 payment. Need some direction here.
Comment #15
chrisrockwell commentedAnother scenario: coupon in sidebar on order_information page - if you apply a coupon that makes the total $0, it doesn't refresh the page so the payment information pane is still visible.
Comment #16
nikathoneAdded support for collecting billing info only and added need test coverage tag. We still have to deal with scenario in #15.
Comment #17
nikathoneUpdated
commerce_payment.schema.ymlto includecommerce_checkout.commerce_checkout_pane.payment_informationComment #18
adanielyan commentedWith patch #17 and collect_none, every time I add a product to cart it skips the payment step as expected, but no order is created. I only see the Complete message
Shouldn't an order be created as usual? In fact when I navigate to admin/commerce/orders/XX, where XX is the [last order id] + 1, I can see the order, but it is not displayed in admin/commerce/orders list. Besides every time I add another free product to cart or checkout an order the XX order is overwritten.
UPDATE: OK, after a little more exploration I found that an order is in fact being created but not placed. When I click on Place Order button the order appears in the list. I think the free orders should be placed by default.
Comment #19
nikathone@adanielyan can you please provide more details about the version of commerce you are using and your setup? Cause when I did test #14 patch it place the order and most of my update on #17 didn't change any of that.
Comment #20
adanielyan commentedI have Commerce 8.x-2.1 installed, not dev. However the patch was applied without a problem. I didn't try #14, only #17.
Here is my order type config. The workflow is Fulfillment.
I have Contact information disabled. Can it be an issue?
Comment #21
nikathoneHmmmm! If I am not mistaken with the fulfillment workflow you kind have to do things manually. Can you please try with the default workflow and see if it will work?
Thanks
Comment #22
adanielyan commentedSame thing with Default workflow. Order is created as Draft. I can't find where in Commerce module's code the status of order is changed to "completed" to understand why that line of code is not executed. Do you by chance know where it is?
Comment #23
adanielyan commentedWhat is strange is that even though the order seems to be created as Draft (with id 42):
it is not listed in orders list:
Comment #24
adanielyan commentedIn commerce_order table in database the order_number, checkout_step, and placed for order 42 are all NULL:
Comment #25
adanielyan commentedComment #26
mglamanReviewing this.
Comment #27
mglamanComment #28
mglamanNot sure what happened in #18 through #25. I don't know how this patch could have caused that, but proves needs for tests.
Hacking away at https://github.com/drupalcommerce/commerce/pull/847, will post updated patch here.
Comment #29
mglamanRerolled with two changes.
This is free_orders
Provided default value, moved values to const
now for tests.
Comment #31
mglamanThis has three tests for the three options.
Concerns for possible follow up, so we can open the floodgates around free orders. We can try to tackle them here, but I have a feeling there will be various issues which crop up, and getting the base functionality in is the best option.
The step label is really odd when the order is free.
In \Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentProcess::isVisible
The `payment_information` pane is not visible when COLLECT_NONE. But it is when COLLECT_BILLING, so we need the isZero check. The problem here is that isZero actually kills COLLECT_ALL and the payment method generation. So, currently, COLLECT_ALL is a broken option. Do we
Comment #32
mglaman`collectBillingProfile` method which returns this boolean.
This is on pause for a moment. Discussing with bojanz as it always has /some/ impact in #2871483: Add checkout settings for payment method behavior for Payment Information pane settings.
Comment #33
mglamanWe have identified that this should focus down to hiding the payment method form if the order total is zero. The only reason you would collect a payment method on a free order is for later use. This requires "always save" option as described in #2871483: Add checkout settings for payment method behavior.
Comment #34
bojanz commentedBasically, we'll always collect billing info for now, attack "no billing info" for both free and non-free orders at a later point.
Comment #35
mglamanHere is a simplified patch.
collectBillingProfileOnlymethod to support later "forced storing of payment methods, even free orders"We can follow up with a "Don't collect anything at all" if it is required. But going this route simplified things.
Comment #36
sorabh.v6Return comment indentation must 3 spaces but found 2 (Nitpick).
Unused use statement.
Comment #37
jonnyeom commentedJust fixing the Nitpicks.
Comment #38
mglamannikathone tested this and gave it a thumbs up. Marking RTBC and assigning to bojanz for feedback.
Comment #40
bojanz commentedWe should have a mechanism for changing the summary fieldset title.
We can then change both the pane title and the summary fieldset title to "Billing information" when that's the only thing that's being displayed. Showing "Payment information" doesn't make sense when it's just billing information.
The code feels hard to follow now. I'd perform the "is free order" check on the very top of the method, returning just the billing information form in that case. We'll need to move the billing information form code to a helper for that to work.
Let's not use a helper until we need it. Hardcoding $this->order->getTotalPrice()->isZero() is cleaner for the time being, since free orders will land in a different release from the payment method settings.
This is hard to follow, let's split it into two separate checks.
Comment #41
bojanz commentedStill need to resolve Matt's "Pay and complete order" @todo.
Comment #44
bojanz commentedI went with "Complete checkout" for the button label. Not completely convinced, open to suggestions in a followup.
We also discussed "Finish your order" and "Complete order", but this felt better for now.
Comment #46
freelylw commentedhas this done in the latest 2.13 version ? I still don't see how to complete a free order without going through the payment.
Comment #47
Ivo.Radulovski commentedsame here, trying to provide 100% discount codes, but free orders seem not to work. Any feedback?
Comment #48
kerasai commentedI had to extend the
PaymentInfopane, where I copied the entirebuildPaneFormand deleted the conditional at the top where it checks for paid/zero-balance orders.Comment #49
chandeepkhosa commentedWhile this is a little different from the original issue, from the past few comments I believe this may help some of you.
For my use case a client wants to add a coupon code which changes the order to free (zero cost).
I did this by
Comment #50
joelpittetWe might need to do what @kerasai and extend
PaymentInformationbecause we can get a free order with the promotion but trouble when the product is price 0 to begin with.