Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions gravity-forms/gw-coupons-exclude-products.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Requires Gravity Forms Coupons v1.1
*
* @version 1.2.1
* @version 1.2.2
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
Expand Down Expand Up @@ -69,17 +69,9 @@ function output_script() {

if( window.gform ) {

gform.addFilter( 'gform_coupons_discount_amount', function( discount, couponType, couponAmount, price, totalDiscount ) {
gform.addFilter( 'gform_coupons_discount_amount', function( discount, couponType, couponAmount, price, totalDiscount, formId ) {

// pretty hacky... work our way up the chain to see if the 4th func up is the expected func
var caller = arguments.callee.caller.caller.caller.caller;

if( caller.name != 'PopulateDiscountInfo' ) {
return discount;
}

var formId = caller.arguments[1],
price = price - getExcludedAmount( formId );
price -= getExcludedAmount( formId );

if( couponType == 'percentage' ) {
discount = price * Number( ( couponAmount / 100 ) );
Expand Down