Created
June 17, 2026 12:25
-
-
Save xlplugins/43aacbf13c692849e8adaf9a64d7d6c1 to your computer and use it in GitHub Desktop.
create temporary email during checkout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Plugin Name: FunnelKit – Temporary Email on Checkout | |
| * Description: Stamp a placeholder email on orders placed without one, so FunnelKit creates the contact. | |
| */ | |
| if ( ! defined( 'ABSPATH' ) ) { | |
| exit; | |
| } | |
| add_action( 'woocommerce_checkout_create_order', function ( $order ) { | |
| if ( $order instanceof WC_Order && ! is_email( $order->get_billing_email() ) ) { | |
| $domain = wp_parse_url( home_url(), PHP_URL_HOST ); | |
| $order->set_billing_email( 'no-email+' . uniqid() . '@' . $domain ); | |
| } | |
| }, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment