Search
 
SCRIPT & CODE EXAMPLE
 

PHP

woocommerce disable payment method if coupon appied and total is 0

add_filter('woocommerce_available_payment_gateways', 'applied_coupons_hide_payment_gateways', 20, 1 );
function applied_coupons_hide_payment_gateways( $available_gateways){
    // Not in backend (admin)
    if( is_admin() ) 
        return $available_gateways;

    // If at least a coupon is applied
    if( sizeof( WC()->cart->get_applied_coupons() ) > 0 ){
        // Loop through payment gateways
        foreach ( $available_gateways as $gateway_id => $gateway ) {
            // Remove all payment gateways except BACS (Bank Wire)
            if( $gateway_id != 'bacs' )
                unset($available_gateways[$gateway_id]);
        }
    }

    return $available_gateways;
}
Comment

PREVIOUS NEXT
Code Example
Php :: OR criteria 
Php :: How to get ID and other string in url 
Php :: compare strings alphabetically php 
Php :: get next day date in php 
Php :: cách nhúng php vào html 
Php :: Route::whereIn 
Php :: search bar php progress 
Php :: spatie sluggable not working 
Php :: php zoom api start_time issue 
Php :: php $_POST contains 
Php :: download yii 1.1 
Php :: twig global 
Php :: php runden auf 2 stellen 
Php :: convert code python to php 
Php :: what is WP_USE_THEMES 
Php :: drupal 7 hook_node_insert 
Php :: Remove images from the the_content() 
Php :: user1263019 how to upload a file using php curl 
Php :: HOW TO CREATE AUTO ALPHA NUMERIC PRIMARY KEY BY PHP 
Php :: Comment ajouter nofollow à un lien spécifique ou à tous les liens WordPress dans the_content 
Php :: PHP DocBlocker current date 
Php :: laravel connection timed out 
Php :: php array_intersect_assoc 
Php :: comment_info 
Php :: share var in a maser layout laravel 
Php :: check website ssl certificate using php openssl_x509_parse 
Php :: supprimer un cookie avec un input en php 
Php :: detect mobile device laravel 
Php :: laravel pass multipale provider 
Php :: php set 404 page 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =