• I developed this feature to hide some gateways conditionally if the shipping country chosen by the user is “IT”.
    The Satispay Gateway is not removed, yet the gateway name is correct.

    Suggestions? I read that other users have similar problems.

    function blocca_metodi_pagamento_checkout($available_gateways) {
    if (is_checkout()) {
    $country = WC()->customer->get_shipping_country();

    if ($country !== 'IT') {
    $metodi_da_bloccare = array('satispay', 'paypal', 'bacs', 'stripe');

    foreach ($metodi_da_bloccare as $metodo) {
    if (isset($available_gateways[$metodo])) {
    unset($available_gateways[$metodo]);
    }
    }

    } else {
    if (isset($available_gateways['cheque'])) {
    unset($available_gateways['cheque']);
    }
    }
    }
    return $available_gateways;
    }
    add_filter('woocommerce_available_payment_gateways', 'blocca_metodi_pagamento_checkout');

    The page I need help with: [log in to see the link]

  • You must be logged in to reply to this topic.