Does Drupal Commerce support free orders?
Yes, Drupal Commerce supports free orders thanks to its use of Rules when determining which payment methods should be shown for an order on the checkout form. You can simply add conditions to your payment method rules that require the order total amount to be greater than 0 for a payment method to be shown (and therefore payment to be required). Provided you have not configured the payment method checkout pane to prevent checkout without payment, the customer simply won't see the payment pane and can proceed to the completion page without submitting payment.
The only caveat is in how you structure your checkout completion rules or Rules that react to the "When an order is first paid in full" event. Because you are not collecting payment for the order, no payment transaction will be made. This will prevent the aforementioned Rule from ever being triggered, so any actions you take based on that event may need to be duplicated in a checkout completion rule for free orders.


Comments
Rule for free products without payment screen
I have tried to follow your instructions above and am not quite there. Here is what I have:
{ "rules_free_item_checkouts" : {"LABEL" : "Free Item checkouts",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "commerce_order", "commerce_payment", "commerce_checkout" ],
"ON" : [ "commerce_payment_methods" ],
"IF" : [
{ "commerce_order_compare_total_product_quantity" : {
"commerce_order" : [ "commerce_order" ],
"operator" : "\u003E=",
"value" : "1"
}
},
{ "AND" : [
{ "commerce_payment_order_balance_comparison" : { "commerce_order" : [ "commerce_order" ], "value" : "0" } }
]
}
],
"DO" : [
{ "commerce_checkout_complete" : { "commerce_order" : [ "commerce_order" ] } }
]
}
}
Tried this too and it also didn't work
{ "rules_free_item_checkouts" : {"LABEL" : "Free Item checkouts",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "commerce_order", "commerce_payment" ],
"ON" : [ "commerce_payment_methods" ],
"IF" : [
{ "commerce_order_compare_total_product_quantity" : {
"commerce_order" : [ "commerce_order" ],
"operator" : "\u003E=",
"value" : "1"
}
},
{ "AND" : [
{ "commerce_payment_order_balance_comparison" : { "commerce_order" : [ "commerce_order" ], "value" : "0" } }
]
}
],
"DO" : [
{ "commerce_order_update_state" : { "commerce_order" : [ "commerce_order" ], "order_state" : "completed" } },
{ "commerce_order_update_status" : { "commerce_order" : [ "commerce_order" ], "order_status" : "completed" } }
]
}
}
Any help would be greatly appreciated.
Hi, lets see if this helps.
Hi, lets see if this helps. I'm using a PayPal WPS payment method. I have coupons that can make the amount of an order come to zero. What I am doing in the Payment Methods rule for the payment method is saying "If the order total amount is greater than zero, then display the payment method, otherwise display nothing" - so it should handle the free products scenario that you've described. If anything it might help point you towards a solution.
Here is the exported rule
{ "commerce_payment_paypal_wps" : {"LABEL" : "PayPal WPS",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "commerce_payment" ],
"ON" : [ "commerce_payment_methods" ],
"IF" : [
{ "data_is" : {
"data" : [ "commerce-order:commerce-order-total:amount" ],
"op" : "\u003E",
"value" : "0"
}
}
],
"DO" : [
{ "commerce_payment_enable_paypal_wps" : {
"commerce_order" : [ "commerce-order" ],
"payment_method" : { "value" : {
"method_id" : "paypal_wps",
"settings" : {
"business" : "paypal@example.com",
"currency_code" : "AUD",
"language" : "AU",
"server" : "live",
"payment_action" : "sale",
"ipn_logging" : "notification"
}
}
}
}
}
]
}
}
That did the trick
It took me a little bit to get the GUI to do what I needed but here is what my condition looked like:
Data comparison
Parameter: Data to compare: [commerce-order:commerce..., Operator: is greater than, Data value: 0
Hope this helps anyone else wanting to do this.
A big thanks to Michael!!!