Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Dimos

    (@dimosgeor)

    Woocommerce man!

    • This reply was modified 11 months ago by Dimos.
    Thread Starter Dimos

    (@dimosgeor)

    Thank you George, i appreciate your help!

    Thread Starter Dimos

    (@dimosgeor)

    Hi crodriguez,

    Thats right, the duplicated queries instantly disappeared.

    Thank you very much!

    Thread Starter Dimos

    (@dimosgeor)

    It works! thank you very much!

    Hi, we were collaborating with peros, but unfortunately he had to leave the project ! Here are the parts of snippets that dont work together.

    add_filter( 'woocommerce_available_payment_gateways','disable39A');
    function disable39A( $available_gateways ) {
    	global $woocommerce;
    	 if ( ! is_admin() ) {
    	if(bbloomer_check_category_in_cart())
    	{
    		unset(  $available_gateways['pay_later'] );
    	}
    	 }
    		
    	return $available_gateways;
    }
    
    add_filter( 'woocommerce_available_payment_gateways', 'bbloomer_gateway_disable_shipping_326' );
      function bbloomer_gateway_disable_shipping_326( $available_gateways ) {
         
       if ( ! is_admin() && WC()->session ) {
            
          $chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
            
          $chosen_shipping = $chosen_methods[0];
          
          if ( isset( $available_gateways['pay_later']) && 0 === strpos( $chosen_shipping, 'flat_rate:5'  )){
             unset( $available_gateways['pay_later'] );
    		   unset( $available_gateways['bacs'] );
    		   unset( $available_gateways['eurobank_gateway'] );
    		    unset( $available_gateways['bank_transfer_1'] );
    		    unset( $available_gateways['bank_transfer_2'] );
    		    unset( $available_gateways['bank_transfer_3'] );
    		    unset( $available_gateways['bank_transfer_4'] );
          }
    	    if ( isset( $available_gateways['pay_later']) && 0 === strpos( $chosen_shipping, 'flat_rate:9'  )){
             unset( $available_gateways['pay_later'] );
    		   unset( $available_gateways['bacs'] );
    		   unset( $available_gateways['eurobank_gateway'] );
    			 unset( $available_gateways['bank_transfer_1'] );
    		    unset( $available_gateways['bank_transfer_2'] );
    		    unset( $available_gateways['bank_transfer_3'] );
    		    unset( $available_gateways['bank_transfer_4'] );
          }
    	    if ( isset( $available_gateways['pay_later']) && 0 === strpos( $chosen_shipping, 'flat_rate:14'  )){
             unset( $available_gateways['pay_later'] );
    		   unset( $available_gateways['bacs'] );
    		   unset( $available_gateways['eurobank_gateway'] );
    			 unset( $available_gateways['bank_transfer_1'] );
    		    unset( $available_gateways['bank_transfer_2'] );
    		    unset( $available_gateways['bank_transfer_3'] );
    		    unset( $available_gateways['bank_transfer_4'] );
          }
    	  
    	    if ($chosen_shipping == 'flat_rate:10'){
    			if (is_checkout() && ! is_wc_endpoint_url()){
    	       unset( $available_gateways['pay_later'] );
    		   unset( $available_gateways['bacs'] );
    		   unset( $available_gateways['eurobank_gateway'] );
    				 unset( $available_gateways['bank_transfer_1'] );
    		    unset( $available_gateways['bank_transfer_2'] );
    		    unset( $available_gateways['bank_transfer_3'] );
    		    unset( $available_gateways['bank_transfer_4'] );
    		   }
    			else {
    			 unset( $available_gateways['other_payment'] );
    			}
    		}
    	   else {
    		    unset( $available_gateways['other_payment'] );
    	   }
    	   
       }
         
       return $available_gateways;
         
    }
Viewing 5 replies - 1 through 5 (of 5 total)