### [wpforms_process_validate_payment-coupon](https://wpforms.com/developers/wpforms_process_validate_payment-coupon/)

**Published:** October 20, 2023
**Author:** Editorial Team

**Excerpt:** The wpforms_process_validate_payment-coupon action fires validation on the Coupon form field when the form is submitted. 


**Content:**

## Description

The `wpforms_process_validate_payment-coupon` action fires validation on the **Coupon** form field when the form is submitted.

## Parameters

$field\_id*(int)* Field ID.$field\_submit*(array)* Original raw/unsanitized field value submitted for the field.$form\_data*(array)* Processed form settings/data, prepared to be used later.## Source

`wpforms/includes/class-process.php`

## More Information

The `wpforms_process_validate_payment-coupon` action is applied to the **Coupon** form field for checking the amount of the coupon, as an example is above a particular amount set in the function.

## Examples

In this example, we’re preventing any form submission if the coupon **flat rate** amount is less than **1.00**.

```

/*
 * Do not allow to submit coupons lower than 1.00.
 *
 * @link https://wpforms.com/developers/wpforms_process_validate_payment-coupon/
 *
 * @param int     $field_id        Field ID.
 * @param array   $field_submit    Unsanitized field value submitted for the field.
 * @param array   $form_data       Form data and settings.
*/

function wpf_discard_low_coupons( $field_id, $field_submit, $form_data ) {

	$coupon = wpforms_coupons()->get( 'repository' )->get_coupon_by_code( $field_submit );

	if ( $coupon === null ) {
		return;
	}

	$currency = wpforms_get_currency();

	if ( $coupon->get_discount_type() === 'flat' && (float) $coupon->get_discount_amount() get( 'process' )->errors[ $form_data[ 'id' ] ][ $field_id ] = sprintf( /* translators: %s - Currency code name. */
			esc_html__( 'Coupon amount is less that 1.00 %s. Please, use another one.', 'your-translation-domain' ),
			$currency
		);
	}
}
add_action( "wpforms_process_validate_payment-coupon", 'wpf_discard_low_coupons', 10, 3 );
```

## Related

Article Reference: [How to Restrict Coupons by Amount](https://wpforms.com/developers/how-to-restrict-coupons-by-amount/ "How to Restrict Coupons by Amount")

**Categories:** Actions Hooks

**Tags:** Coupons, PHP

---

