Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter mgracedev

    (@mgracedev)

    this is the page https://www.idem-singapore.com/contact-us-3/

    this is the setting of the form in the backend

    https://ibb.co/N3NLFvP
    https://ibb.co/bWLsJ6L

    Thread Starter mgracedev

    (@mgracedev)

    hi,

    yes, you’re right. we’re using https://www.advancedcustomfields.com/ to add custom field name so that we can use these fields to recalculate the total amount before passing it in payment gateway.

    we have have the form field manager but i’m not sure if the client will approve on this approach. everytime they need to add field in the form using the addon form field manager, they need to put fixed meta key that i will provide so that these meta keys will be used in calculating the total sum and other mandatory fields.it will be tedious to do plus if the meta key is wrong, it won’t be included in the calculation of total sum.we’re trying to avoid the miscalculation on the total amount sum.

    also, i saw the snippet on how to add custom field via code like this one

    add_action( 'give_fields_after_donation_amount', function( $collection ) {
        $collection->append(
            give_field( 'text', 'Birth City' )
                ->showInReceipt()
                ->label( __('Birth City') )
                ->minLength(2)
                ->maxLength(30)
                ->placeholder('Your birth city')
                ->storeAsDonorMeta()
                ->required() // Could instead be marked as readOnly() (optional)
                ->helpText( __( 'This is a field used to add your birth city.' ) )
        );
    });

    but using this approach will put this kind of fields in all forms which is not the client wants cause not all custom fields are available in some forms.

    the requirements are like these:

    • create custom text fields for multiple donation amount aside from the default one and use these calculate the final total amount
    • create radio field with price amount. if the user selected yes, the value in that radio will also be added in the final total amount
    Thread Starter mgracedev

    (@mgracedev)

    Hi @wpdebuglog,

    Thank you for replying.

    Is this the hook?

    `/* cfdb7 before save data. */
    $form_data = apply_filters(‘cfdb7_before_save_data’, $form_data);

    do_action( ‘cfdb7_before_save_data’, $form_data );

    I’m just wondering how can i use it in functions.php. my function should return invalid to wpcf7 but i can’t seem to understand on how will i use this hook.

Viewing 3 replies - 1 through 3 (of 3 total)