Viewing 1 replies (of 1 total)
  • Thread Starter Václav Greif

    (@vasikgreif)

    For anyone actually needing this, here’s the code that works for me…

    function payment_gateway_disable_country( $available_gateways ) {
    
        $chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
        $chosen_shipping = $chosen_methods[0];
    
        if ( isset( $available_gateways['bacs'] ) && $chosen_shipping=='ppl_dobirka') {
            unset(  $available_gateways['bacs'] );
        }
        return $available_gateways;
    }
    add_filter( 'woocommerce_available_payment_gateways', 'payment_gateway_disable_country' );
Viewing 1 replies (of 1 total)
  • The topic ‘Disable payment method for custom shipping method’ is closed to new replies.