• Resolved sabakhurrum

    (@sabakhurrum)


    i don’t want to show wallet payment option when selected shipping option is flat rate. I tried a plugin but it only hides the wallet when total billed amount is lower than the wallet balance. Pls help. Thanks a lot

Viewing 1 replies (of 1 total)
  • Plugin Author Subrata Mal

    (@subratamal)

    @sabakhurrum Please use the attached code in theme functions.php file to disable wallet partial payment if shipping method is flat rate.

    add_filter( 'woo_wallet_disable_partial_payment', 'woo_wallet_disable_partial_payment_callback', 10, 1 );
    if ( ! function_exists( 'woo_wallet_disable_partial_payment_callback' ) ) {
    	function woo_wallet_disable_partial_payment_callback( $is_disabled ) {
    		$chosen_methods  = WC()->session->get( 'chosen_shipping_methods' );
    		$chosen_shipping = $chosen_methods[0];
    		if ( 0 === strpos( $chosen_shipping, 'flat_rate' ) ) {
    			$is_disabled = true;
    		}
    		return $is_disabled;
    	}
    }
    
    add_filter( 'woo_wallet_partial_payment_amount', 'woo_wallet_partial_payment_amount_callback', 10, 1 );
    if ( ! function_exists( 'woo_wallet_partial_payment_amount_callback' ) ) {
    	function woo_wallet_partial_payment_amount_callback( $amount ) {
    		$chosen_methods  = WC()->session->get( 'chosen_shipping_methods' );
    		$chosen_shipping = $chosen_methods[0];
    		if ( 0 === strpos( $chosen_shipping, 'flat_rate' ) ) {
    			$amount = 0;
    		}
    		return $amount;
    	}
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Hide wallet payment in flat rate shipping’ is closed to new replies.