Maharaja adlı üyeden alıntı: mesajı görüntüle
Wordpress WooCommerce: Sadece IBAN ile Ödemeye İndirim Mümkün müdür? nasıl yapabilirim? kredi kartı sanal pos ile ödemede indirim istemiyorum.
Merhaba,
functions.php ye yapıştırınız :

add_action( 'woocommerce_cart_calculate_fees', 'odeme_yontemi_indirimi' );
function odeme_yontemi_indirimi( $cart ) {
    if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return;

    $secilen_odeme = WC()->session->get( 'chosen_payment_method' );

   
    if ( $secilen_odeme !== 'bacs' ) return;

    $indirim_orani  = 15; // İstediğiniz yüzdeliğe göre değiştirin
    $ara_toplam     = $cart->get_subtotal();
    $indirim_tutari = $ara_toplam * ( $indirim_orani / 100 );

    $cart->add_fee(
        'Havale/EFT İndirimi (%' . $indirim_orani . ')',
        -$indirim_tutari,
        true 
    );
}


add_action( 'wp_footer', 'odeme_degisince_sepeti_guncelle' );
function odeme_degisince_sepeti_guncelle() {
    if ( ! is_checkout() ) return;
    ?>
    <script>
    jQuery(function($){
        $('form.checkout').on('change', 'input[name="payment_method"]', function(){
            $('body').trigger('update_checkout');
        });
    });
    </script>
    <?php
}