I use the Front End Product Submission form. One of the items is the Regular price field. I want to set a default value which the user cannot change.
Do you have a suggstion for this.
Thx for clarifying.
Hello. Thank you for contacting the Toolset support.
There are couple of ways, to set regular price either you can add it as hidden field and set it's default value or you can use the Toolset Form's hook "cred_save_data" that will run after you submit the form.
function func_custom_update_product_regular_price($post_id, $form_data) {
// if a specific form
if ($form_data['id']==99999) {
update_post_meta($post_id,'_regular_price', 1111);
}
}
add_action('cred_save_data', 'func_custom_update_product_regular_price', 10, 2);
Where:
- Change the 99999 with your original form ID
- change 1111 with the actual regular price you want to set.