How to limit Woocommerce wallet setting?
-
Hi,
I wanted to limit a user to use only 20% of amount from his/her wallet when he/she checkouts and rest from payment method. I tried the code from this post : https://www.ads-software.com/support/topic/woocommerce-wallet-limit-settings/
Code I tried is as follows in my public_html/wp-content/themes/basel:add_filter(‘is_valid_payment_through_wallet’, ‘__return_false’);
add_filter(‘woo_wallet_partial_payment_amount’, ‘woo_wallet_partial_payment_amount_callback’, 10, 2);function woo_wallet_partial_payment_amount_callback($amount, $order) {
if (!is_null($order)) {
$order_total = $order->get_total(‘edit’);
if ($amount > $order_total) {
$amount = ($order_total * 20) / 100;
}
} else if (sizeof(wc()->cart->get_cart()) > 0) {
$cart_total = wc()->cart->get_total(‘edit’);
if ($amount > $cart_total) {
$amount = ($cart_total * 20) / 100;
}
}
return $amount;
}
But the issue that I m facing is while i click on add to cart button products are not getting added in the cart .Please help me out with it.Thank you.The page I need help with: [log in to see the link]
- The topic ‘How to limit Woocommerce wallet setting?’ is closed to new replies.