We search in taxonomies for certain terms. The search phrase $search_data (in our example: 4000342) comes from a search form field.
The query looks like this and does work in general already, when the search phrase matches the terms exactly:
$search_data = 4000342;
$args = array (
'post_type' => 'product',
'tax_query' => array(
array(
'taxonomy' => 'pa_version',
'field' => 'slug',
'terms' => $search_data
)
),
);
This search show all products with the Taxonomy term 4000342.
But there are a lot of different terms that contain the search phrase (4000342) as part of the term, for example: XC-KK-4000342-8.
We want to show all products where the taxonomy term contains the search phrase.
We tried different operators in the tax_query, but none of them seem to work in this case. How do we do a partial match using tax_query?