Hey,
I need help getting a form to work correctly. The form is to quote customers who want their windows cleaned, however because it’s typically low value, my client wants a minimum price adding to the quote. I’ve been following this tutorial which seems to work on the front-end but doesn’t work when sending the quote and only sends the email with the product totals. Here’s what I mean:
By default, the total products = £6.00
So the minimum fee applies to make it £12.00
But when the quote is emailed to both admin and the user it shows £6.00
Here’s the link to the extra screenshots.
Anyone know how I can get the email to show the exact same as the front end? The code I’ve used is below:
<script type="text/javascript">
gform.addFilter( 'gform_product_total', function(total, formId){
//only apply logic to form ID 3
if(formId != 3)
return total;
if(total < 12)
total = 12;
return total;
} );</script>
and in the functions.php
/**
* GRAVITY FORMS
*/
add_filter( 'gform_product_info', 'add_fee', 10, 3 );
function add_fee( $product_info, $form, $lead ) {
$minimumprice = 12;
$currentprice = $product_info['products'][1]['price'];
$currentprice = str_replace('$','',$currentprice);
$additionalfee = $minimumprice - $currentprice;
if ( $currentprice >= 12 ) {
$product_info = array(
'products' => array(
array(
'name' => 'Minimum Order Amount',
'price' => 12,
'quantity' => 1,
),
),
);
}
return $product_info;
}

