Woocommerce search product based on attributes
<p>I have the simple products having the attributes like color: red, from year: 1988, to year:1994, etc.</p>

<p>I have created search form that search the product based on the parameter selected in form's drop down.</p>

<p>The form contain two drop down. 1-Color,  2-Year.</p>

<p>I have the problem with year attributes. The functionality would be like when users select the year (for example 1990) from the drop down then it should return all the products whose “From Year” value less then selected value(1990) and “To Year” value is greater than selected value(1990).</p>

<p>That means selected value must be between products from year and to year.
Please help me to write meta query that return the products list as describe above.</p>

<pre><code>'meta_query' =&gt; array( 
                  array( 'relation'=&gt; 'AND' ), 
                  array( 'key' =&gt; '_product_attributes', 
                         'value' =&gt; red, 
                         'compare' =&gt; 'like'),
                  ),
</code></pre>