• Resolved LogicRays Technologies

    (@logicrays)


    Hi
    any idea why this code is not working ? I need to hide payment gateway based on below condition”
    My checkout page url: https://xyz.co.uk/checkout/?action=reserved

    add_filter( 'woocommerce_available_payment_gateways', 'hide_paypal_enable_manager' );
     
    function hide_paypal_enable_manager( $available_gateways ) {
    global $woocommerce;
    
    if ( $_GET['action'] == 'reserved' ) {
    	unset( $available_gateways['paypal'] );
    }
    return $available_gateways;
    }

    Thanks
    LR

Viewing 2 replies - 1 through 2 (of 2 total)
  • The filter is being called twice during page load. The function works the first time, but the second time there is a different $_GET array and $_GET[‘action’] is undefined.

    melinda a11n

    (@melindahelt)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional payment gateway’ is closed to new replies.