Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gravity Perks // GP eCommerce Fields // Set Tax Amount Dynamically
<?php
/**
* Gravity Perks // GP eCommerce Fields // Set Tax Amount Dynamically
* https://gravitywiz.com/documentation/gravity-forms-ecommerce-fields/
*/
add_filter( 'gform_pre_render_123', 'gpecf_dynamic_tax_amount' );
add_filter( 'gform_pre_validation_123', 'gpecf_dynamic_tax_amount' );
add_filter( 'gform_pre_submission_filter_123', 'gpecf_dynamic_tax_amount' );
add_filter( 'gform_admin_pre_render_123', 'gpecf_dynamic_tax_amount' );
function gpecf_dynamic_tax_amount( $form ) {
if( $form['fields'][0]->is_form_editor() ) {
return $form;
}
foreach( $form['fields'] as &$field ) {
if( $field->id == 4 ) {
$field->taxAmount = 25;
}
}
return $form;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.