ACF checkbox return format based on page

You have to return the output with the value. you can check the following code.


function hello_shortcode() { 
 
    // Load field settings and values.
    $field = get_field_object('producent');

    if( ! is_product_category() ) {
        $checkbox = $field['value'];
    } else {
        $checkbox = $field['label'];
    }

    $output="‹p›".$checkbox.'‹/p›';

    return $output;

} 

// register shortcode
add_shortcode('hello', 'hello_shortcode');