Home › Forums › Front-end Issues › WooCommerce widget with ACF included › Reply To: WooCommerce widget with ACF included
Ok, I’ve been able to a bit further and can edit the widgets now.
I’ve created an IF statement so that if the colour hasn’t been selected it will not show.
However, they’re all coming back “no” despite 2 colours having selected.
function woo_colour_swatches( $term_html, $term, $link, $count ) {
$color = get_field('colour', $term);
if( $colour ){
echo 'Yes';
}else{
echo 'No';
}
echo '<a href=" '. $link .' ">'. $term->name .'</a>';
return $some_modified_value;
}
add_filter( 'woocommerce_layered_nav_term_html', 'woo_colour_swatches', 10, 4 );
**UPDATE**
Mis-spelt color with colour
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.