Skip to content

Instantly share code, notes, and snippets.

@jessepearson
Created August 2, 2019 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessepearson/f36567682dd44e2e044bd3594d4ea079 to your computer and use it in GitHub Desktop.
Save jessepearson/f36567682dd44e2e044bd3594d4ea079 to your computer and use it in GitHub Desktop.
Removes the payment instructions from the COD payment gateway in WooCommerce.
<?php // do not copy this line
/**
* Removes the payment instructions from the COD payment gateway in WooCommerce.
*/
function jp_custom_remove_instructions(){
if ( ! class_exists( 'WC_Payment_Gateways' ) ) {
return;
}
$gateways = WC_Payment_Gateways::instance(); // gateway instance
$available_gateways = $gateways->get_available_payment_gateways();
if ( isset( $available_gateways['cod'] ) ) {
remove_action( 'woocommerce_email_before_order_table', array( $available_gateways['cod'], 'email_instructions' ), 10, 3 );
}
}
add_action( 'woocommerce_email_before_order_table', 'jp_custom_remove_instructions', 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment