cwcfp_field_label_append_after
The cwcfp_field_label_append_after filter allows you to add content after a conditional field's label. For example, you may want to add the repeat value or other similar text after the field label.
This filter has 3 arguments passed to it:
- $return: Default is an empty string ''
- $repeat: The nth time this field has been displayed on the checkout page.
- $field_id: The ID of the field found in the Conditional Field's settings.
// Add the repeat value after the label for field ID #1
add_filter( 'cwcfp_field_label_append_after', 'your_custom_function', 10, 3 );
function your_custom_function( $return, $repeat, $field_id ){
switch( $field_id ){
// Add the repeat value after the label for $field_id 1
case 1:
$return = ' ' . $repeat;
break;
default:
break;
}
return $return;
}
// Add a link to terms and conditions after the label for field ID #2
add_filter( 'cwcfp_field_label_append_after', 'your_custom_function_for_link', 10, 3 );
function your_custom_function_for_link( $return, $repeat, $field_id ){
switch( $field_id ){
// Add the repeat value after the label for $field_id 2
case 2:
$return = '<a href="http://example.com">View Terms and Conditions</a>';
break;
default:
break;
}
return $return;
}