In this tutorial we will explain how to bridge your WordPress forms to Dolibarr to set up a transactional form that creates product quotations. The resulting bridge will create a prospect third party, and a new quotation linked to the former and with a product line with unit price and quantity.
This tutorial assumes you have access to a Dolibarr instance with access to the REST API and the proposals module enabled.
Enable the addon
The first step is to enable the Dolibarr addon on the general tab of the settings page.

Once the addon is enabled, we can create bridges to work with the REST API. In addition Forms Bridge offers some templates to start creating our bridges, and workflow jobs.
The template wizard
To streamline the creation process, we will use the Proposals template from the addon. To use it, simply go to Add bridge tab on the addon’s page and click on Use a template. After that, the template wizard will be displayed. On the templates dropdown, select the option Proposals.

Backend and form steps
The next step on the wizard will ask us for the backend connection. The backend connection will ask us for a name, the URL and an API key. Leave the default backend name and set the URL and your api key and Forms Bridge will perform a ping to the backend to check the health of the connection. If all goes well, the template wizard will allow us to continue.
This step is only required if you already don’t have any backend connection. If you’ve created a backend before, you can simply reuse it and click next.

One step more, the Form step. In this step the wizard will ask us for a title for the form. You can go with the default title or edit it if you want. After that, click next to go to the last step.

The bridge step
Now we are on the bridge step. In this step the wizard will ask us for all the information he need to configure the bridge. In this case, the wizard will ask us for the bridge name (remember, it should be unique as it is the identifier), for a product, and the prospect status. The selected product will be used to create the quotation line.
The product dropdown is populated with the products from your Dolibarr instance. If the dropdown is empty, probably you have to create some products on Dolibarr and then come back here. Take in mind that the price of the product multiplied by the quantity field value of the form will be the quotation amount.

Submit the template
Once done, click on submit and let the magic happen. Behind the curtain, Forms Bridge will create the backend connection, a new form and a new bridge that will connect the form with the backend. Go to your forms admin page and check for it! The bridge is ready for use, you can stop here or continue editing the bridge with custom configurations to fit your specific use case.

Additional configurations
After using the template you will have a bridge with the following workflow:

Lets see what happen on each job of the pipeline and how you can add custom configurations to the bridge:
- Form submission: This is the first step of the pipeline and allow us to apply mutation layers to the form submission. In this step the template defines mutation layers to set up the third party name and to map the form
quantity
form field and thefk_product
custom field to the line object. - Country ID: This job checks that the field
country_id
has a valid value or try to get a valid ID from country name or country iso2 code. This is required because the third party endpoints only accept IDs as country values. - Third party: This workflow job is the responsible to create a new third party on Dolibarr based on the form data. The job will searches for an existing third party by
name
,email
andtva_intra
and, if it does not exists, creates a new one. Once done, all contact fields as removed and replaced by thesocid
field.
The output of the pipeline should be a payload like this:
{
"date": "$timestamp",
"socid": 1,
"lines": [{
"product_type": 1,
"fk_product": 1,
"qty": 1
}]
}
With this setup, the resulting quotation will inherit the price of the product defined in Dolibarr. If you want to set a custom product sale price for this quotation form, you can add a new custom field lines[0].subprice
with the custom price to your bridge. Same with taxes: If you add a custom field lines[0].tva_tx
with a percentage value like 21, you will overwrite the default taxes on Dolibarr for this product line.
If you need to go further with payload mutations you always can use the forms_bridge_payload
filter to mangle your bridge submissions with PHP and all of its power and flexibility. Checkout the API documentation.
To conclude, its worth to mention that you can get the same bridge setup doing it manually, but with templates you can save a lot of time! We strongly recommend you to check for templates before start creating new bridges.