Skip to content

Instantly share code, notes, and snippets.

@malsubrata
Created December 4, 2019 16:02
Show Gist options
  • Save malsubrata/c3140fc7b7b9eb909346ec3e14f554f0 to your computer and use it in GitHub Desktop.
Save malsubrata/c3140fc7b7b9eb909346ec3e14f554f0 to your computer and use it in GitHub Desktop.
add_filter('is_enable_wallet_partial_payment', '__return_true');
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) {
$cart_total = get_woowallet_cart_total();
$partial_payment_amount = ($cart_total * 20) / 100;
if ($amount >= $partial_payment_amount) {
$amount = $partial_payment_amount;
}
}
return $amount;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment