diff --git a/gp-ecommerce-fields/gpecf-set-discount-amount-via-gpep.php b/gp-ecommerce-fields/gpecf-set-discount-amount-via-gpep.php new file mode 100644 index 000000000..a23caf810 --- /dev/null +++ b/gp-ecommerce-fields/gpecf-set-discount-amount-via-gpep.php @@ -0,0 +1,41 @@ +id == 3 ) { + // Update "6" to the field that will be populated by Easy Passthrough with the discount amount. + $field->discountAmount = gw_get_gpep_value( $form['id'], 6 ); + } + } + + return $form; +} + +function gw_get_gpep_value( $form_id, $field_id ) { + + if ( GFForms::get_page() && rgget( 'lid' ) ) { + $entry = GFAPI::get_entry( rgget( 'lid' ) ); + $field_values = $entry; + } else { + $field_values = gp_easy_passthrough()->get_field_values( $form_id ); + } + + return rgar( $field_values, $field_id ); +}