Home › Forums › General Issues › True/False Product Category › Reply To: True/False Product Category
A good friend on mine solved the issue. Here is the working code:
// Use 1 column layout for art series with one work ACF based
function vv_custom_cat_layout( $options ) {
$terms = get_terms([
'taxonomy' => 'product_cat',
'hide_empty' => true,
'meta_query' => [
'key' => 'series_one_work',
'value' => 1
]
]);
$AcfFilter = [];
foreach($terms as $term)
array_push($AcfFilter, $term->slug); // i'm never sure if is term_name or just name, sorry
if ( is_product_category( $AcfFilter ) )
$options['columns'] = 1;
return $options;
}
add_filter( 'option_generate_woocommerce_settings','vv_custom_cat_layout' );
Thanks @vverner for all your help! really appreciated.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.