The trick is to provide a WooCommerce product id conditionally and for the same logic, hide the payment element. Let’s walk through it.
#1: Form Setup
First setup your product price calculation as usual. In the sample form, we have a simple radio element to select from available products and one math element to show the price.
The only thing required here is an element to put conditional logic against. We have added a radio element with two options.
- Add to cart.
- Quick checkout.
We want to use WooCommerce when user selects Add to cart and just show the eForm payment field when user selects Quick checkout.
So we note down the element id, which in our case is
#2: Enable WooCommerce and eForm Payment
First enable WooCommerce and put math element id. Do not put any product id in the main product id field.
We will put product id (in our case 1002) in the conditional product selector. We put the condition against element
add to cart.
Now eForm will only activate WooCommerce when the condition is met. Internally it works like this.
- eForm resolves WooCommerce product id from your base and conditional definition.
- eForm checks if the product id is not empty and the product exists.
- If it exists, then activate WooCommerce checkout.
- Otherwise, don’t activate WooCommerce.
#3: Enable General Payment
Now enable eForm payment options and add a payment element. We need to add similar logic to the payment element, but for the opposite condition.
So we put logic
Now eForm will only activate general payment if the condition is met.
So what we did here is, create two mutually exclusive conditions. For one condition, we activate WooCommerce and for the other we activate eForm Payment.
If you have any question, feel free to ask through support forum.