Guest User

Untitled

a guest
Aug 14th, 2019
52
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php // do not copy this line
  2.  
  3. /**
  4. * Removes the payment instructions from the COD payment gateway in WooCommerce.
  5. */
  6. function jp_custom_remove_instructions(){
  7. if ( ! class_exists( 'WC_Payment_Gateways' ) ) {
  8. return;
  9. }
  10.  
  11. $gateways = WC_Payment_Gateways::instance(); // gateway instance
  12. $available_gateways = $gateways->get_available_payment_gateways();
  13.  
  14. if ( isset( $available_gateways['cod'] ) ) {
  15. remove_action( 'woocommerce_email_before_order_table', array( $available_gateways['cod'], 'email_instructions' ), 10, 3 );
  16. }
  17. }
  18. add_action( 'woocommerce_email_before_order_table', 'jp_custom_remove_instructions', 1 );
RAW Paste Data