Skip to content
Browse files

updated so that it is smarter when it finds the coupon total

  • Loading branch information...
1 parent f6d5a67 commit d756e2854ea51139137be17bff3c43fc5ffe3043 @curtismchale committed May 28, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 coupons-for-gravityforms.php
View
14 coupons-for-gravityforms.php
@@ -305,10 +305,20 @@ function sfn_gfcoupon_update_product_info( $product_info, $form, $lead ){
global $total;
$id = $form['fields'][0]['id'];
- $price = $product_info['products'][$id]['price'];
+
+ /**
+ * Figuring out which field is the product field so that we can know
+ * what field to override before we send it to PayPal
+ */
+ foreach( $form['fields'] as $field ){
+ if( $field['type'] == 'product' ){
+ $id = $field['id'];
+ }
+ }
+
$product_info['products'][$id]['price'] = $total;
return $product_info;
}
add_filter( 'gform_product_info', 'sfn_gfcoupon_update_product_info', 10, 3 );
-?>
+?>

0 comments on commit d756e28

Please sign in to comment.
Something went wrong with that request. Please try again.