Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save xlplugins/a3db83565e47f2361427215154a9e0b7 to your computer and use it in GitHub Desktop.

Select an option

Save xlplugins/a3db83565e47f2361427215154a9e0b7 to your computer and use it in GitHub Desktop.
Order button above HTML Field
/**FunnelKit - trust_section on wfacp_after_gateway_list */
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
const WFACP_TRUST_ID = 'trust_section';
add_action( 'wfacp_after_template_found', function () {
static $d = false;
if ( $d || ! class_exists( 'WFACP_Common' ) || ! function_exists( 'wfacp_form_field' ) ) {
return;
}
$d = true;
add_filter( 'wfacp_forms_field', function ( $f, $k ) {
$t = $f['type'] ?? ( $f['field_type'] ?? '' );
return ( WFACP_TRUST_ID === $k && 'wfacp_wysiwyg' === $t ) ? array() : $f;
}, 20, 2 );
add_action( 'wfacp_after_gateway_list', function () {
if ( ! ( $p = WFACP_Common::get_id() ) ) {
return;
}
foreach ( (array) WFACP_Common::get_checkout_fields( $p ) as $g ) {
if ( empty( $g[ WFACP_TRUST_ID ] ) || ! is_array( $a = $g[ WFACP_TRUST_ID ] ) ) {
continue;
}
if ( empty( $a['type'] ) && ! empty( $a['field_type'] ) ) {
$a['type'] = $a['field_type'];
}
if ( 'wfacp_wysiwyg' !== ( $a['type'] ?? '' ) || empty( $a['default'] ) ) {
continue;
}
echo '<div class="wfacp-trust-reloc" style="margin-top:1.25rem">';
wfacp_form_field( WFACP_TRUST_ID, $a, WC()->checkout()->get_value( WFACP_TRUST_ID ) );
echo '</div>';
break;
}
}, 10 );
}, 999 );

Comments are disabled for this gist.