Hi everyone, how are you? This is my first post :D.
I need a help if possible. I have a form that has some products and I achieved to make only one product in the list, with custom price if a certain option (radio) is checked, which is great.
However I have tried many ways but I can’t recover the final discount value applied by some coupon. I want to be able to use this coupon value to subtract from the price.
My code so far.
function changeP( $product_info, $form, $entry ) {
if ( rgar( $entry, '143' ) == '3' ) {
//Get the total value of the field '83'
$price = $product_info['products'][83]['price'];
//If the coupon exists get the amount
$couponAmount = rgars( $entry, 'couponAmount' );
$product_info = array(
'products' => array(
array(
'name' => 'All Products',
'price' => $price - $couponAmount,
'quantity' => 1,
),
),
);
}
return $product_info;
}
//
add_filter( 'gform_product_info', 'changeP', 10, 3 );
Sorry for bad English
Regards