Skip Navigation

[Cerrado] Try to make a form with cred

This support ticket is created hace 6 años, 7 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Etiquetado: 

This topic contains 1 respuesta, has 2 mensajes.

Last updated by Ross Fisher hace 6 años, 7 meses.

Assigned support staff: Ross Fisher.

Autor
Mensajes
#364287

Hello,

I need to make a form in which the boxes I check have a price.

For example, tick in this products you'd like:
T-shirt: (box) 20€
jeans: (box) 26€
shoes: (box) 40€

If I choose T-shirt + jeans -> Total: 46€
I I choose jeans + shoes -> 66 €

I would like a form that calculate the final price and shows the products you want (like a shop but just as a form).

Is it possible?

Thanks

#364409

Thank you for contacting Toolset support, I'd be delighted to assist!

This would require custom PHP logic to calculate the pricing and store the final value in the field. You could use the Types API to find how to $get the field contents, then use the CRED Hooks API to write them to the DB when saving the form. Please see:

https://toolset.com/documentation/user-guides/displaying-wordpress-custom-fields/
https://toolset.com/documentation/user-guides/cred-api/

Basically upon form save:
1. $GET the values of your checkbox custom fields
2. Add them together
3. Store the final value to another field eg. "Final Price" upon cred_save_data

El debate ‘[Cerrado] Try to make a form with cred’ está cerrado y no admite más respuestas.