To accept either cash or electronic payment this is really your best option. One alternative would be to apply a 100% discount to the form if the user selected to pay by cash but this would require recalculating the total somehow to know what to charge them when they do pay.
You actually can do this in one form. It’s a bit of work and is significantly more work if you have a lot of products, but it works all in one form.
We’ll need two (2) calculations:
total
set_price
total
We’re going to add up all the products and their quantities (even the ones with 0 selected). The way to do this is illustrated in the Calculate our own subtotal section in this how-to:
Similarly, we’re then going to add a custom pricing rule that subtracts that amount from the price when it’s answered. This gives us more freedom in dictating how pricing will work on the form.
set_price
This is almost the exact same calculation as above, so you can just duplicate the calculation to save yourself the work.
Instead of simply returning the total or subtotal, we’re going to grab the value from the the yes/no question. Let’s call it isCard. We’ll also need to update our price in a custom pricing rule based on whether the answer is “yes” or “no” and let’s default to showing the total price on the form even if no selection has been made yet.
So, remove subtotal; (if you used the same variable from the linked post above) from the bottom of your calculation and add:
This will give us the total price of all selections if the yes/no question is either not answered or is answered with “Yes.” Otherwise, it will give us 0.
Now, add a new custom pricing rule:
When set_price is answered then + answer
Note: You are setting the option is answered, not is and then typing in answered.
For cash orders, clicking to the next page will simply submit the form with no Stripe gateway shown since $0 isn’t meant to be charged. You can refer to total in the form submission data to get the cost of their order. Alternatively, you could split this out into another calculation and call it cash_price or something if you want it more explicit and apart from the logic of removing the price from the form. It doesn’t make a difference functionally, but your preference is fine here.
For card orders, the customer will be directed to the payment gateway after moving forward and charged the price associated with their selections.
I left the calculations visible so you can see how they work in real-time when you select “Yes” or “No” about paying with card. You’ll want yours to remain hidden, which they are by default unless you toggle the option off.
Thank you so much for this great instruction. However, I need more help to finalise the form, Please!
I followed your guide and have accomplished 2 steps:
I managed to create the form successfully for the free shipping >= $50 like this guide. Here is my final form
I created another form for the two calculations: total + set_price
However, I could not make the form as yours. The issue is with the option No for the card payment. The submit button didn’t change to submit, it still shows the total money as the Yes for card
I’ll make sure to make it clearer in the instructions as I can see how the two options (isanswered versus is answered) might be confusing to someone less acquainted with the calculation!