WooCommerce TeraWallet Amount Limit settings
-
I want terawallet amount limit where I can fix 20% of the total cart value. As the customer will buy the product, the there customer will get 20% of the cart value usage of wallet balance.
I am using the following codes but getting an error “The site is experiencing technical difficulties” as soon as I click on add to cart.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;
}Please, help me with this.
- The topic ‘WooCommerce TeraWallet Amount Limit settings’ is closed to new replies.