@thomasplevy
For Open Registration it is working fine
I would add it to free checkout (https://lifterlms.com/docs/checkout-free-access-plans/)
I made the code what allow me to do that:
After below code in class.llms.person.handler.php
$voucher = get_option( 'lifterlms_voucher_field_' . $screen . '_visibility', '' );
if ( 'registration' === $screen && 'hidden' !== $voucher ) {
$toggleable = apply_filters( 'llms_voucher_toggleable', ( 'required' === $voucher ) ? false : true );
$voucher_label = __( 'Have a voucher?', 'lifterlms' );
if ( $toggleable ) {
$voucher_label = '<a class="llms-voucher-toggle" id="llms-voucher-toggle" href="#">' . $voucher_label . '</a>';
add_action( 'wp_print_footer_scripts', array( __CLASS__, 'voucher_toggle_script' ) );
}
$fields[] = array(
'columns' => 12,
'id' => self::$meta_prefix . 'voucher',
'label' => $voucher_label,
'last_column' => true,
'placeholder' => __( 'Voucher Code', 'lifterlms' ),
'required' => ( 'required' === $voucher ) ? true : false,
'style' => $toggleable ? 'display: none;' : '',
'type' => 'text',
);
}
I added:
if ( 'checkout' === $screen && !$uid) {
$toggleable = apply_filters( 'llms_voucher_toggleable', ( 'required' === 'required' ) ? false : true );
$voucher_label = __( '<p>Custom text</p>', 'lifterlms' );
if ( $toggleable ) {
$voucher_label = '<a class="llms-voucher-toggle" id="llms-voucher-toggle" href="#">' . $voucher_label . '</a>';
add_action( 'wp_print_footer_scripts', array( __CLASS__, 'voucher_toggle_script' ) );
}
$fields[] = array(
'columns' => 12,
'id' => self::$meta_prefix . 'voucher',
'label' => $voucher_label,
'last_column' => true,
'placeholder' => __( 'Voucher Code', 'lifterlms' ),
'required' => true,
'style' => $toggleable ? 'display: none;' : '',
'type' => 'text',
);
}
I just wonder how to inject it by LifterLMS Customizations