Add errors if empty field on new-product.php
-
How do I add an error if a field is empty on /mytheme/dokan/products/new-product.php?
I see dokan is looping throw errors with:
dokan()->dashboard->templates->products->has_errors()How do I add an error to this function?
I’m currently using this function to add a new field and want to make it required
function x_add_fields_save( $post_id ){ // save condition when user adds a new product if(isset($_POST['item_condition'])){ $condition = $_POST['item_condition']; if(!empty($condition)){ update_post_meta( $post_id, 'item_condition', esc_attr($condition) ); } } }// add fields add_action( 'woocommerce_process_product_meta', 'x_add_fields_save' ); add_action( 'dokan_process_product_meta', 'x_add_fields_save' ); add_action( 'dokan_new_product_added', 'x_add_fields_save' );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Add errors if empty field on new-product.php’ is closed to new replies.