Skip to content

Instantly share code, notes, and snippets.

@ScottDeLuzio
Last active December 29, 2017 15:13
Show Gist options
  • Save ScottDeLuzio/408fd8fabfb5be30b0804ad0322a2e65 to your computer and use it in GitHub Desktop.
Save ScottDeLuzio/408fd8fabfb5be30b0804ad0322a2e65 to your computer and use it in GitHub Desktop.
Add content before your conditional checkout fields for WooCommerce
<?php
function show_before_field_group( $content, $repeat, $field_number ){
return 'This is some <strong>test</strong> info that will show up before each group of fields';
if( $repeat == 1 && $field_number == 2 ){
return 'This is some <strong>test</strong> info will show up only before the first instance of the field with ID 2';
}
}
add_filter( 'cwcfp_before_conditional_field_grouping', 'show_before_field_group', 10, 3 );
function show_before_each_field_id_one( $content, $repeat, $field_number ){
if( $field_number == 1 ){
return 'To append the field number after this text, do this: ' . $field_number;
}
}
add_filter( 'cwcfp_before_conditional_field_grouping', 'show_before_each_field_id_one', 10, 3 );
function show_before_each_field_id_one_repeat( $content, $repeat, $field_number ){
if( $field_number == 1 ){
return 'To append the repeat number after this text, do this: ' . $repeat;
}
}
add_filter( 'cwcfp_before_conditional_field_grouping', 'show_before_each_field_id_one', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment