Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @alvarenga1,

    This pop-up template is new in Dokan 2.5.1 and to add this required fields you simply need to add some code in your theme functions. In your theme functions.php file add these lines at the bottom:

    
    add_filter( 'dokan_new_product_popup_args', 'rt_888_check_required_fields', 99, 2 );
    
    function rt_888_check_required_fields( $error, $data ) {
     
        $required_fields = array(
            'feat_image_id'  => __( 'Please Upload an Image' , 'dokan' ),
            '_regular_price' => __( 'Please Set Price' , 'dokan' ),
            'post_excerpt'   => __( 'Please include a short description' , 'dokan')
        );
    
        foreach ( $required_fields as $key => $msg ) {
            
            if ( empty( $data[$key] ) ) {
                return new WP_Error( 'required-missing', $msg );
            }
        }
        
        return '';
        
    }

    And then go to the dokan plugin folder and find
    your-site/wp-content/plugins/dokan-plugin/includes/product-functions.php

    add these lines on line 46 :

    $error = apply_filters( 'dokan_new_product_popup_args' , '' , $data );
        
        if ( is_wp_error( $error ) ) {
            return $error;
        }

    Do not worry about future updates as your changes will be preserved within the updates.

    Have a good day.

    Thread Starter alvarenga1

    (@alvarenga1)

    Working Perferct!
    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Required fields create or edit product.’ is closed to new replies.