Created
August 2, 2019 13:10
-
-
Save jessepearson/f36567682dd44e2e044bd3594d4ea079 to your computer and use it in GitHub Desktop.
Removes the payment instructions from the COD payment gateway in WooCommerce.
This file contains 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 // 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