Hi Team,
We have a specific use-case where we want the Title of the Listing to be the same as the Category.
So, when a vendor is creating a listing, we want this to happen on the fly i.e. when the Vendor selects from the Category dropdown, the Title should get auto-populated with the same value as the selected Category.
We tried writing a code snippet, however it did not work. Can you please help us out?
function assign_category_to_title($form) {
$value = '';
add_filter('hivepress/v1/forms/listing_submit', function($form) use (&$value) {
$value = $form['fields']['categories']['value'];
return $form;
}, 1000);
add_filter('hivepress/v1/forms/listing_update', function($form) use (&$value) {
$form['fields']['title']['value'] = $value;
return $form;
}, 1000);
return $form;
}
// Apply the filters within the function
add_filter('hivepress/v1/forms/listing_update', 'assign_category_to_title');
Thanks,
Team Purohit Connect