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