Hi, just to update that first condition of putting wallet amount usage has been resolved.
add_filter('is_valid_payment_through_wallet', '__return_false');
add_filter('woo_wallet_partial_payment_amount', 'woo_wallet_partial_payment_amount_callback', 10);
function woo_wallet_partial_payment_amount_callback($amount) {
if (sizeof(wc()->cart->get_cart()) > 0) {
$wallet_balance = woo_wallet()->wallet->get_wallet_balance(get_current_user_id(), 'edit');
$cart_total = get_woowallet_cart_total();
$partial_payment_amount = ($wallet_balance * 30) / 100;
if($cart_total >= $partial_payment_amount){
$amount = $partial_payment_amount;
}
}
return $amount;
}
But the second condition of restricting wallet for specific product category is still not resolved
add_filter('woo_wallet_payment_is_available', 'woo_wallet_payment_is_available_callback');
if(!function_exists('woo_wallet_payment_is_available_callback')){
function woo_wallet_payment_is_available_callback($is_available){
$categories = array('cashback-products');
$has_category = false;
// Loop through cart items
foreach ( WC()->cart->get_cart() as $cart_item ) {
// Check for product categories
if ( has_term( $categories, 'product_cat', $cart_item['product_id'] ) ) {
$is_available = false;
}
return $is_available;
}
}
}
@hasanalkhaled Please use those codes in the active theme functions.php file.