cwcfp_fee_label_count
The cwcfp_fee_label_count
filter allows you to change the label that is added to a fee when more than one of the same field is adding a fee.
By default this will add the field's number in square brackets after the field's fee label.
Note: It is important that when fees are not being grouped in the plugin's settings that each fee has a unique label, otherwise WooCommerce will override the fees.
For example, fees will be added with labels in this manner:
- Fee label [field quantity]
On the checkout page, it might look like this:
- Gift Message [1]
- Gift Message [2]
- Gift Message [3]
- ...and so on
The cwcfp_fee_label_count
filter has three attributes passed to it:
$fee_label_count
: This will always be ' [$i]' where $i is equal to the field quantity. In a checkout page that has three of the same field, this could be 1, 2, or 3.$field_id
: This is the conditional field's ID$i
: The field quantity.
If you do not want the unique identifier to be shown in square brackets but instead want a hyphen separating the fee label and the identifier, you could do the following:
add_filter( 'cwcfp_fee_label_count', 'remove_square_brackets', 10, 3 ); function remove_square_brackets( $fee_label_count, $field_id, $i ) { return ' - ' . $i; }