Untitled

 avatar
webwizards
plain_text
10 months ago
1.0 kB
19
Indexable
add_filter('b2bking_request_quote_title', function($title){

	$title_field_id = 12345; // replace with the ID of your field

	$value = sanitize_text_field($_POST['b2bking_field_'.$title_field_id]);
	if (!empty($value)){
		$title = $value;
	}

	return $title;
}, 10, 1);

add_action('b2bking_after_send_quote_cart', function($conversationid){

	$title_field_id = 12345; // replace with the ID of your field

	$value = sanitize_text_field($_POST['b2bking_field_'.$title_field_id]);
	if (!empty($value)){
		update_post_meta($conversationid, 'b2bking_quote_title', $value);
	}

}, 10, 1);

add_action('salesking_dashboard_head', function(){
	if (isset($_GET['quote'])){
		$quote_id = sanitize_text_field($_GET['quote']);
		if (!empty($quote_id)){
			$title = get_post_meta($quote_id, 'b2bking_quote_title', true);
			?>
			<script>
				jQuery(document).ready(function(){
					setTimeout(function(){
						jQuery('#b2bking_new_offer_title').val("<?php echo $title;?>");
					}, 500);
				});
			</script>
			<?php
		}
	}
});
Editor is loading...
Leave a Comment