Skip to content

Commit

Permalink
Check UPI Address pattern only if UPI address is shown and required.
Browse files Browse the repository at this point in the history
  • Loading branch information
knit-pay committed Nov 11, 2024
1 parent 2316b25 commit ed62fa7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion includes/class-payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ public function validate_fields() {
if ( $this->upi_address === 'show_handle' ) {
$regex = '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*$/i';
}
if ( ! preg_match( $regex, sanitize_text_field( $_POST['customer_upiwc_address'] ) ) && in_array( $this->upi_address, [ 'show', 'show_handle' ] ) && $this->require_upi === 'yes' ) {
if ( in_array( $this->upi_address, [ 'show', 'show_handle' ] ) && $this->require_upi === 'yes' &&! preg_match( $regex, sanitize_text_field( $_POST['customer_upiwc_address'] ) ) ) {
wc_add_notice( __( 'Please enter a <strong>valid UPI Address</strong>!', 'upi-qr-code-payment-for-woocommerce' ), 'error' );
return false;
}
Expand Down

0 comments on commit ed62fa7

Please sign in to comment.