Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Created October 27, 2025 06:21
Show Gist options
  • Save xlplugins/90cbbc10292c14911e192f4bd5f6fdb1 to your computer and use it in GitHub Desktop.
Save xlplugins/90cbbc10292c14911e192f4bd5f6fdb1 to your computer and use it in GitHub Desktop.
FunnelKit Checkout + Constant Contact WooCommerce Position Moved to billing email address
if ( ! class_exists( 'WFACP_Compatibility_Constant_Contact' ) ) {
class WFACP_Compatibility_Constant_Contact {
private $instance;
private $process_field = false;
public function __construct() {
add_action( 'wfacp_after_checkout_page_found', [ $this, 'setup_hooks' ] );
add_action( 'wfacp_internal_css', [ $this, 'add_css' ] );
}
public function setup_hooks() {
if ( ! class_exists( 'WebDevStudios\CCForWoo\View\Checkout\NewsletterPreferenceCheckbox' ) ) {
return;
}
$this->process_field = true;
$checkbox_location = get_option( 'cc_woo_store_information_checkbox_location', 'woocommerce_after_checkout_billing_form' );
global $wp_filter;
if ( isset( $wp_filter[ $checkbox_location ] ) ) {
foreach ( $wp_filter[ $checkbox_location ]->callbacks as $priority => $callbacks ) {
foreach ( $callbacks as $callback ) {
if ( is_array( $callback['function'] ) &&
isset( $callback['function'][0] ) &&
$callback['function'][0] instanceof WebDevStudios\CCForWoo\View\Checkout\NewsletterPreferenceCheckbox ) {
$this->instance = $callback['function'][0];
remove_action( $checkbox_location, $callback['function'], $priority );
add_action( 'wfacp_after_billing_email_field', [ $this->instance, 'add_field_to_billing_form' ], 10 );
return;
}
}
}
}
}
public function add_css() {
if ( ! $this->process_field ) {
return;
}
?>
<style>
body #wfacp-sec-wrapper span.woocommerce-input-wrapper span.optional{line-height:1;top:0;position:relative;}
</style>
<?php
}
}
new WFACP_Compatibility_Constant_Contact();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment