John Davidson

php - Show only grouped products for specific categories

0 comments
Message:


function only_grouped_products( $tax_query ){
$tax_query[] = array(
'taxonomy' => 'product_type',
'field' => 'name',
'terms' => array('grouped'),
);
return $tax_query;
}



here's my code but I want to select grouped products for Imperial Adapters and Metric Adapters categories only



My Answer:
function only_grouped_products( $tax_query ){
$tax_query[] = array(
'taxonomy' => 'product_type',
'field' => 'name',
'terms' => array('grouped'),
);

$tax_query[] = array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array('imperial-adapters', 'metric-adapters'),
);

return $tax_query;
}

Rate this post

3 of 5 based on 3231 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us