• Resolved Hussain Merchant

    (@hussainmerchant)


    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]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Subrata Mal

    (@subratamal)

    Hi @hussainmerchant

    Please use the updated code in the themes function.php file.

    add_filter('is_valid_payment_through_wallet', '__return_false');
    add_filter('woo_wallet_partial_payment_amount', 'woo_wallet_partial_payment_amount_callback');
    function woo_wallet_partial_payment_amount_callback($amount){
        return (woo_wallet()->wallet->get_wallet_balance( get_current_user_id(), 'edit' ) * 20) / 100;
    }
    Thread Starter Hussain Merchant

    (@hussainmerchant)

    Thnx bro for your help and quick support ! Its working fine thnk you so much

    Plugin Author Subrata Mal

    (@subratamal)

    @hussainmerchant

    Could you please consider posting a review for our plugin?

    Thank you.

    Thread Starter Hussain Merchant

    (@hussainmerchant)

    Ya Sure I ll provide the Reviews ??

    Thread Starter Hussain Merchant

    (@hussainmerchant)

    Hi @subratamal ,
    I have one more query , If I want to add limit to total cart amount on woocommerce , how can it be done can you help me out with it ?Like for Eg. Suppose I have a product whose amount is Rs.300 and I want a user to pay 50% from either bank transfer or Online payment or COD and rest remaining from wallet how can this be done ?

    Hi,
    I wanted to limit a user to debit only 2% of ordered amount from his/her wallet if fund is available when he/she checkouts and rest from payment method. I tried the code from this post

    Please help me

    Thread Starter Hussain Merchant

    (@hussainmerchant)

    Hi @sabjifresh ,
    The code will be same as above just with minor change that is instead of 20 you need to use 2 as your requirement is of 2%.
    Below is the edited code :

    add_filter(‘is_valid_payment_through_wallet’, ‘__return_false’);
    add_filter(‘woo_wallet_partial_payment_amount’, ‘woo_wallet_partial_payment_amount_callback’);
    function woo_wallet_partial_payment_amount_callback($amount){
    return (woo_wallet()->wallet->get_wallet_balance( get_current_user_id(), ‘edit’ ) * 2) / 100;
    }

    can anyone help where i have to paste above php code as i also want my custtomer to use only 15% of available wallet amount

    Plugin Author Subrata Mal

    (@subratamal)

    @amitksinha79

    You have to paste the code in themes function.php file. As @hussainmerchant says you have to edit 2 percent with 15 percent to allow 15% wallet usage.

    Thank you.

    Thank you for guiding it got resolved.

    can i also flash msg in wallet that only 15% from wallet amount will be debited with every order

    please help

    can we also keep condition on which only 15% of total cart value consumer can use.

    for better understanding of my query find below example.

    we have asked customer that you will get 20% cash back on purchase of any item

    Customer A is purchasing product worth Rs.4000
    he gets cash back of Rs.800 in his wallet

    now we want whenever he do his next shopping with us he should use only 20% of cart value from wallet and rest he have to pay through other mode.Ex continue:

    Customer A return for next shopping and do it purchase worth Rs. 1000

    he should be able to pay Rs. 150 from wallet and rest from other mode.

    if yes than do we have to change code

    can someone help me

    If wallet’s 20% is greater than total cart amount,then money will not deduct from wallet.& User can’t clicked on pay by wallet option in checkout page.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘How to limit Woocommerce wallet setting?’ is closed to new replies.