changing status and price of a woocommerce product after submitting

This topic contains 1 reply and 2 voices, and was last updated by towhid 9 years, 2 months ago
Viewing 1 Posts - 1 through 1 (of 1 total)
Author Posts
February 12, 2015 at 8:52 pm 36604
towhid Hello, I don't have a lot of experience in wordpress/php So I'd like ask to you for solve this question Registered users can submit products by WPUF in woocommerce. I want that the status of product is set to 'publish' and its price to 0, if users select the meta value 'Free" for the meta key 'project_type'. I've tried adding this code in functions.php /function to update product status to 'publish' // and set the price to 0 for 'free' products function change_post_status($post_id){ $project_type = get_post_meta($post->ID, 'project_type', true); if ($project_type == 'Free') { update_post_meta( $post_id, '_regular_price', 0); $current_post = get_post( $post_id, 'ARRAY_A' ); $current_post['post_status'] = 'publish'; wp_update_post($current_post); } } add_action('wpuf_add_post_after_insert', 'change_post_status'); but nothing happens. have I forgotten to declare same variable? Can you suggest me the correct way to code it? Thank you
February 18, 2015 at 3:06 pm 36993
towhid towhid

Hello Maur1350,

I am really sorry to say we do not provide any customization services. If you need this urgent you can make it yourself or you can hire a developer.

Thank You 🙂

Viewing 1 Posts - 1 through 1 (of 1 total)