With ez Form calculator, it is possible to add custom forms with dynamic pricing to WordPress sites using WooCommerce. With the help of conditional logic and calculation fields, you can create diverse WooCommerce forms.
WooCommerce Forms Integration
In order to integrate ez Form Calculator with WooCommerce, you can do one of the following options:
- Forms will add a single WooCommerce product to the cart
- A Single Form will add multiple WooCommerce products to the cart
- Multiple Forms will add multiple WooCommerce products to the cart
Before you’re going to integrate forms with WooCommerce, please update your plugin to the latest version and check the following requirements:
- The option “Integrate with WooCommerce” is enabled in the global settings
- If you want all form values to persist in the cart, you have to enable the option “Show selected values in checkout” in the global settings
- Not a requirement but good to know: if you want to use the current price of the product in the form, use the Hidden element and enable the element option “Use_woocommerce_price“
Show Forms in Products
There are two different ways to add forms to WooCommerce products:
- Add the form shortcode to the product content
If you don’t want to add the shortcode to each product manually:
- Enable Add forms to products in the global settings and…
- Set the Global form ID (global settings) to the relevant form ID or…
- Add a custom field (NOT attribute) named ezfc_form_id with the form ID as value in the WooCommerce product(s). If you don’t see the custom fields view, click on “Screen options” at the top of the page and enable the “Custom fields” checkmark.
1) Forms Will Add a Single WooCommerce Product to the Cart
If you want to add a single product to the cart upon submission, open up the form options, click on the “WooCommerce” tab and enter the product ID in the “WooCommerce Product ID” option:
2) A Single Form Will Add Multiple WooCommerce Products to the Cart
In case you want to show a single form on all product pages, go to the Global settings page and click on the WooCommerce tab. You need to change the option Global form ID to the form ID you want to show.
3) Multiple Forms and Products
You also have the possibility to show individual forms for products. Add a custom field to WooCommerce products and name them ezfc_form_id along with the form ID as value.
If the form is not displayed in the right section of your page, you need to change the value of Global Settings > WooCommerce > Form display hook. A nice overview of compatible hooks can be seen on businnessbloomer.com
Troubleshooting
If adding products to the cart fails (“Unable to add product #x to the cart”), make sure…
- … your product(s) exists at all (check the ID)
- … your product(s) have a price (0 works, too)
- … your product(s) are published (not set as draft)