• Resolved lauralisa

    (@lauralisa)


    Hi there,

    I have added a function to hide a gateway when the cart total is under 869,-. But now the extra costs arent added anymore? How is this possible?

    Regards,
    Laura

    add_filter('woocommerce_available_payment_gateways','ll_unset_gateway'); 
    function ll_unset_gateway($available_gateways){
    global $woocommerce;
    
    if($woocommerce->cart->total < 869){
    	 	unset( $available_gateways['cheque'] );
    	}
        
    	return $available_gateways;
    }

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author hemsingh1

    (@hemsingh1)

    Hi there,

    We are working on custom filter for this plugin that can be utilized as per the needs specified in your post. We will release an updated plugin for the same shortly in the next 8 to 12 hours.

    Thanks & Regards,
    hemsingh1

    Thread Starter lauralisa

    (@lauralisa)

    Great!!

    Plugin Author hemsingh1

    (@hemsingh1)

    Hi,

    I believe you are using the parameters incorrectly. After doing a bit of testing, I think your function should be written as follows:

    add_filter(‘woocommerce_available_payment_gateways’,’ll_unset_gateway’,1);
    function ll_unset_gateway($available_gateways){

    if(WC()->cart->subtotal < 869){
    unset( $available_gateways[‘cheque’]);
    }

    return $available_gateways;
    }

    see the link below for demo:

    https://mydealstm.com/testplugin/shop

    Thread Starter lauralisa

    (@lauralisa)

    So great, thank you!!!!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Extra costs gone after adding function’ is closed to new replies.