Home › Forums › Theme Support › Dokan › Default stock set to 1 This topic is: resolved Tagged: -1, default, stock This topic contains 2 replies, has 2 voices, and was last updated by towhid 4 years, 4 months ago. Viewing 3 posts - 1 through 3 (of 3 total) Author Posts December 25, 2014 at 4:04 am #32952 StephenMember Post count: 16 Hi, I'm using dokan plugin. I want to make it so when a user adds a product, stock management is turned on by default and the stock is set to 1. Can you help me do that? December 25, 2014 at 6:37 am #32954 StephenMember Post count: 16 I have managed to do this myself. This is how I did it: Inside the file classes/template-shortcodes.php around line 145 just after $post_data = apply_filters( 'dokan_insert_product_post_data', array( 'post_type' => 'product', 'post_status' => $product_status, 'post_title' => $post_title, 'post_content' => $post_content, 'post_excerpt' => $post_excerpt, ) ); $product_id = wp_insert_post( $post_data ); I have added the following code //Set default stock to 1 update_post_meta( $product_id, '_manage_stock', 'yes' ); update_post_meta( $product_id, '_stock', '1' ); I hope this helps the other people trying to do this. December 27, 2014 at 12:11 pm #32975 towhidParticipant Post count: 4505 Hello Stephen, Very well solution. I have tested and it works for me. Hope it will help other people if they want to. Thank You 🙂 Author Posts Viewing 3 posts - 1 through 3 (of 3 total) The topic ‘Default stock set to 1’ is closed to new replies.