Support

Account

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