I am using advanced custom fields checkbox and have it set to return format "both label & value". I would like to display checkbox value on the frontend except if the page is woocommerce product category, then it should output the label. I have created a shortcode in order to output the checkbox value/label in the frontend. The only problem is, that it keeps outputting "array" and not label/value as I would like it to do.
function hello_shortcode() {
// Load field settings and values.
$field = get_field_object('producent');
if( !is_product_category() ) {
$checkbox = $field['value'];
} else {
$checkbox = $field['label'];
}
return $checkbox;
}
// register shortcode
add_shortcode('hello', 'hello_shortcode');