Skip to content

Instantly share code, notes, and snippets.

@vanbo
Created October 12, 2016 09:12
Show Gist options
  • Select an option

  • Save vanbo/6ca6e793be71ee5eabf4c33781125390 to your computer and use it in GitHub Desktop.

Select an option

Save vanbo/6ca6e793be71ee5eabf4c33781125390 to your computer and use it in GitHub Desktop.
Remove BACS details from WooCommerce Thank You page
add_action( 'init', 'remove_bacs_from_thank_you_page', 100 );
function remove_bacs_from_thank_you_page() {
// Bail, if we don't have WC function
if ( ! function_exists( 'WC' ) ) {
return;
}
// Get all available gateways
$available_gateways = WC()->payment_gateways()->get_available_payment_gateways();
// Get the Bacs gateway class
$gateway = isset( $available_gateways['bacs'] ) ? $available_gateways['bacs'] : false;
// We won't do anything if the gateway is not available
if ( false == $gateway ) {
return;
}
// Remove the action, which places the BACS details on the thank you page
remove_action( 'woocommerce_thankyou_bacs', array( $gateway, 'thankyou_page' ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment