Hide wallet payment in flat rate shipping

[ad_1]

@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;
	}
}

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer