the data-value doesnt show, is to use. if you want to show it, it should be inside the a tag, once it is php code with variables must be inside the php “tags”
so should be something like this
<li data-value="<?php echo $_location1; ?>"><a href="#"><?php echo $_date1.' '.$_location1; ?></a></li>
this will show this “Friday, 29 October 2021 Leicester”
if you want first the location can be done like this
<li data-value="<?php echo $_location1; ?>"><a href="#"><?php echo $_location1.' - '.$_date1; ?></a></li>
this will show this “Leicester – Friday, 29 October 2021”
I had put a ‘ – ‘ because seems better.
However its a choise.
the inteire code with the last example should be this one
$_date1 = get_post_meta(get_the_ID(),'_date1', true);
$_date2 = get_post_meta(get_the_ID(),'_date2', true);
$_date3 = get_post_meta(get_the_ID(),'_date3', true);
$_location1 = get_post_meta(get_the_ID(),'_location1', true);
$_location2 = get_post_meta(get_the_ID(),'_location2', true);
$_location3 = get_post_meta(get_the_ID(),'_location3', true);
$product_id = get_the_ID();
$status = get_post_meta( $product_id, '_stock_status', true );
/*$terms = get_the_terms ( $product_id, 'product_cat' );
foreach ( $terms as $term ) {
echo $cat_id = $term->term_id;
}*/
if($status == 'instock' && !empty($_date1) || !empty($_date2) || !empty($_date3))
{
?>
<div class="custom-meta-field">
<div class="input-group">
<input type="hidden" ID="datebox" Class="form-control"></input>
<input type="hidden" ID="locationbox" Class="form-control"></input>
<div class="input-group-btn">
<button type="button" class="btn dropdown-toggle" data-toggle="dropdown">
Select Booking Date
<span class="fa fa-caret-down"></span>
</button>
<ul id="demolist" class="dropdown-menu">
<?php if($_date1): ?>
<li data-value="<?php echo $_location1; ?>"><a href="#"><?php echo $_location1.' - '.$_date1; ?></a></li>
<?php endif; if($_date2):?>
<li data-value="<?php echo $_location2; ?>"><a href="#"><?php echo $_location2.' - '.$_date2; ?></a></li>
<?php endif; if($_date3):?>
<li data-value="<?php echo $_location3; ?>"><a href="#"><?php echo $_location3.' - '.$_date3; ?></a></li>
<?php endif; ?>
</ul>
</div>
</div>
</div>
<?php
}
//echo '<p>No dates currently available</p>';
}