Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to remove payment link in invoice woocommerce

// Show/hide payment gateways
add_filter( 'woocommerce_available_payment_gateways', 'conditionally_hide_payment_gateways', 100, 1 );
function conditionally_hide_payment_gateways( $available_gateways ) {
    // 1. On Order Pay page
    if( is_wc_endpoint_url( 'order-pay' ) ) {
        // Get an instance of the WC_Order Object
        $order = wc_get_order( get_query_var('order-pay') );

        // Loop through payment gateways 'pending', 'on-hold', 'processing'
        foreach( $available_gateways as $gateways_id => $gateways ){
            // Keep paypal only for "pending" order status
            if( $gateways_id !== 'paypal' && $order->has_status('pending') ) {
                unset($available_gateways[$gateways_id]);
            }
        }
    }
    // 2. On Checkout page
    elseif( is_checkout() && ! is_wc_endpoint_url() ) {
        // Disable paypal
        if( isset($available_gateways['paypal']) ) {
            unset($available_gateways['paypal']);
        }
    }
    return $available_gateways;
}
Comment

PREVIOUS NEXT
Code Example
Php :: wpdb insert or if exists update 
Php :: wordpress plugin public page 
Php :: implement class in autoloader athow to implment data table in laravel project 
Php :: joomla k2 api 
Php :: PHP number_format — Format a number with grouped thousands 
Php :: php switch case 
Php :: yii2 modules commands are not showing in console 
Php :: razorpay refund laravel 
Php :: Nginx + Laravel - Moving blog from subdomain to /blog 
Php :: php helper to get day from 0-6 
Php :: Criando shortcode no Wordpress 
Php :: require_once in class php 
Php :: cout post on category in controller laravel 
Php :: fix-wordpress-limit-permalink 
Php :: phpstorm entity identification 
Php :: contact us page mail prestashop 
Php :: php execute script wait for response 
Php :: laravel get relation camelcase api 
Php :: how to depreciate a class in php comments 
Php :: laravel pagination bootstrap sorting column 
Php :: formidable forms formsLimit logged-in users to two entries per day 
Php :: bitnami lightsail PHP Fatal error: Out of memory (allocated 
Php :: yii2 label of ActiveField 
Php :: traduction website 
Php :: php Change the WooCommerce loop product link based on a custom field 
Php :: php get list of months by year 
Php :: Enqueue WP scripts and styles from a single action hook. 
Php :: cake php 2.x group 
Php :: How to Filter Your Posts & Pages by Custom Field in WordPress Dashboard 
Php :: laravel csv import to database 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =