Advertisement
Guest User

working payment method condition

a guest
Feb 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. function authorize_less($available_gateways) {
  2. $maximum = 0;
  3. if ( WC()->cart->total < $maximum ) {
  4. unset( $available_gateways['authorizenet'] );
  5. }
  6. return $available_gateways;
  7. }
  8. add_filter( 'woocommerce_available_payment_gateways', 'authorize_less');
  9. add_action( 'woocommerce_cart_calculate_fees' , 'authorize_less' );
  10. add_action( 'woocommerce_after_cart_item_quantity_update', 'authorize_less' );
  11.  
  12.  
  13.  
  14. function authorize_more($available_gateways) {
  15. $maximum = 0;
  16. if ( WC()->cart->total > $maximum ) {
  17. unset( $available_gateways['cod'] );
  18. }
  19. return $available_gateways;
  20. }
  21. add_filter( 'woocommerce_available_payment_gateways', 'authorize_more');
  22. add_action( 'woocommerce_cart_calculate_fees' , 'authorize_more' );
  23. add_action( 'woocommerce_removed_coupon', 'authorize_more' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement