what would be the easiest way to have an order tha...
# support
e
what would be the easiest way to have an order that, when checked out, only collects a deposit rather than the balance? i would expect to be able to manage these orders that have unpaid balances, and i'd eventually facilitate collecting the missing dough.
b
I would start with trying to remove the requirement for a
paid
payment state for a completed order.
Mainly because in the end, you'll want the ability to be able to know when there is
balance_due
.
And it should be quite common for this company to have completed orders with a balance_due.
Then create a check on the product if it requires a deposit, set an amount for said deposit, then when the order completes, collect the deposit.
And update the code that skips the payment being paid fully required to conditional if the order includes a line item whose product is deposit only.
Since they submitted a deposit, you'll have their payment information on hold and you can easily go into the admin, create a new payment with their payment method for the remaining due.
Here's some code that may useful:
It looks like you can have a completed order whose payment_state can be
balance_due
since the only action is to process the pending payments. https://github.com/solidusio/solidus/blob/main/core/lib/spree/core/state_machines/order.rb#L118-L120