'I want to force the seller to sell for more than 3 dollars

I have a multi-vendor store on WordPress using Dokan on the page to add a product I want to make the price and image field required and I found this code after I searched in Google, please I want to force the seller to sell for more than 3 dollars, if he enter the price of more than Three dollars appears with an error. Regards

<?php
/**
 * Validation add for product cover image
 *
 * @param array $errors
 * @return array $errors 
 */
function dokan_can_add_product_validation_customized( $errors ) {
  $postdata       = wp_unslash( $_POST );
  $featured_image = absint( sanitize_text_field( $postdata['feat_image_id'] ) );
  $_regular_price = absint( sanitize_text_field( $postdata['_regular_price'] ) );
  if ( isset( $postdata['feat_image_id'] ) && empty( $featured_image ) && ! in_array( 'Please upload a product cover image' , $errors ) ) {
      $errors[] = 'Please upload a product cover image';
  }
  if ( isset( $postdata['_regular_price'] ) && empty( $_regular_price ) && ! in_array( 'Please insert product price' , $errors ) ) {
      $errors[] = 'Please insert product price';
  }
  return $errors;
}
add_filter( 'dokan_can_add_product', 'dokan_can_add_product_validation_customized', 35, 1 );
add_filter( 'dokan_can_edit_product', 'dokan_can_add_product_validation_customized', 35, 1 );
function dokan_new_product_popup_validation_customized( $errors, $data ) {
  if ( isset( $data['_regular_price'] ) && ! $data['_regular_price'] ) {
    return new WP_Error( 'no-price', __( 'Please insert product price', 'dokan-lite' ) );
  }
  if ( isset( $data['feat_image_id'] ) && ! $data['feat_image_id'] ) {
    return new WP_Error( 'no-image', __( 'Please select AT LEAST ONE Picture', 'dokan-lite' ) );
  }
}
add_filter( 'dokan_new_product_popup_args', 'dokan_new_product_popup_validation_customized', 35, 2 );


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source