Skip to content

Instantly share code, notes, and snippets.

@ipokkel
Last active September 19, 2024 12:45
Show Gist options
  • Save ipokkel/475243b635ce7ace89588852e0169f4e to your computer and use it in GitHub Desktop.
Save ipokkel/475243b635ce7ace89588852e0169f4e to your computer and use it in GitHub Desktop.
Force remove Stripe billing fields on checkout and billing
<?php // Do NOT copy this line
function hide_address_on_billing_update_if_stripe() {
global $pmpro_pages, $gateway;
// Bail if necessary
if ( empty( $pmpro_pages ) || ( ! is_page( $pmpro_pages['checkout'] ) && ! is_page( $pmpro_pages['billing'] ) ) ) {
return;
}
// Filter out Stripe billing fields
if ( ! empty( $gateway ) && 'stripe' === $gateway ) {
add_filter( 'pmpro_include_billing_address_fields', '__return_false' );
}
}
add_action( 'wp_head', 'hide_address_on_billing_update_if_stripe' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment